mirror of
https://oauth2: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@github.com/m1ngsama/TNT.git
synced 2026-06-26 05:44:38 +08:00
Guard active help surfaces
This commit is contained in:
parent
fab8b315a5
commit
f2be702a15
4 changed files with 97 additions and 4 deletions
1
Makefile
1
Makefile
|
|
@ -126,6 +126,7 @@ unit-test:
|
||||||
script-test: all
|
script-test: all
|
||||||
@echo "Running script tests..."
|
@echo "Running script tests..."
|
||||||
@cd tests && ./test_cli_options.sh
|
@cd tests && ./test_cli_options.sh
|
||||||
|
@cd tests && ./test_docs_help_surface.sh
|
||||||
@cd tests && ./test_logrotate.sh
|
@cd tests && ./test_logrotate.sh
|
||||||
@cd tests && ./test_message_log_tool.sh
|
@cd tests && ./test_message_log_tool.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@
|
||||||
and server survival stay responsive.
|
and server survival stay responsive.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Updated `tnt(1)` to document the current TUI search and pager keys, and
|
||||||
|
added script coverage to keep active help surfaces free of removed support
|
||||||
|
commands.
|
||||||
- `make install-systemd` now rewrites the installed unit's `ExecStart` to match
|
- `make install-systemd` now rewrites the installed unit's `ExecStart` to match
|
||||||
the selected `PREFIX`/`BINDIR`, so package builds that install to `/usr`
|
the selected `PREFIX`/`BINDIR`, so package builds that install to `/usr`
|
||||||
produce a unit pointing at `/usr/bin/tnt`.
|
produce a unit pointing at `/usr/bin/tnt`.
|
||||||
|
|
|
||||||
74
tests/test_docs_help_surface.sh
Executable file
74
tests/test_docs_help_surface.sh
Executable file
|
|
@ -0,0 +1,74 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Regression checks for active help/manual surfaces.
|
||||||
|
|
||||||
|
PASS=0
|
||||||
|
FAIL=0
|
||||||
|
|
||||||
|
pass() {
|
||||||
|
echo "✓ $1"
|
||||||
|
PASS=$((PASS + 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
echo "✗ $1"
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
printf '%s\n' "$2"
|
||||||
|
fi
|
||||||
|
FAIL=$((FAIL + 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
require_fixed() {
|
||||||
|
file="$1"
|
||||||
|
text="$2"
|
||||||
|
label="$3"
|
||||||
|
|
||||||
|
if grep -F -q "$text" "../$file"; then
|
||||||
|
pass "$label"
|
||||||
|
else
|
||||||
|
fail "$label missing" "$file: $text"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
forbid_fixed() {
|
||||||
|
file="$1"
|
||||||
|
text="$2"
|
||||||
|
label="$3"
|
||||||
|
|
||||||
|
if grep -F -q "$text" "../$file"; then
|
||||||
|
fail "$label still mentions $text" "$file"
|
||||||
|
else
|
||||||
|
pass "$label excludes $text"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "=== TNT Help Surface Tests ==="
|
||||||
|
|
||||||
|
require_fixed "tnt.1" "/ Search message history" "manual documents NORMAL search"
|
||||||
|
require_fixed "tnt.1" "Space/b Scroll full page down/up" "manual documents space/b paging"
|
||||||
|
require_fixed "tnt.1" "PageDown/PageUp Scroll full page down/up" "manual documents page keys"
|
||||||
|
require_fixed "tnt.1" "End/Home Jump to bottom/top" "manual documents end/home"
|
||||||
|
require_fixed "tnt.1" "g/G Jump to top/bottom" "manual documents g/G"
|
||||||
|
require_fixed "tnt.1" ":lang Show current UI language" "manual documents current language"
|
||||||
|
require_fixed "tnt.1" ":lang \fIen|zh\fR Switch UI language for this session" "manual documents language codes"
|
||||||
|
|
||||||
|
for file in \
|
||||||
|
README.md \
|
||||||
|
docs/EASY_SETUP.md \
|
||||||
|
docs/DEPLOYMENT.md \
|
||||||
|
docs/INTERFACE.md \
|
||||||
|
docs/QUICKREF.md \
|
||||||
|
docs/USER_LIFECYCLE.md \
|
||||||
|
tnt.1 \
|
||||||
|
tntctl.1 \
|
||||||
|
src/command_catalog.c \
|
||||||
|
src/help_text.c \
|
||||||
|
src/manual_text.c
|
||||||
|
do
|
||||||
|
forbid_fixed "$file" ":support" "$file"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "PASSED: $PASS"
|
||||||
|
echo "FAILED: $FAIL"
|
||||||
|
[ "$FAIL" -eq 0 ] && echo "All tests passed" || echo "Some tests failed"
|
||||||
|
exit "$FAIL"
|
||||||
23
tnt.1
23
tnt.1
|
|
@ -167,6 +167,8 @@ Press
|
||||||
to return to INSERT,
|
to return to INSERT,
|
||||||
.B :
|
.B :
|
||||||
to enter COMMAND mode,
|
to enter COMMAND mode,
|
||||||
|
.B /
|
||||||
|
to search message history,
|
||||||
.B ?
|
.B ?
|
||||||
to open the full key reference.
|
to open the full key reference.
|
||||||
.TP
|
.TP
|
||||||
|
|
@ -198,6 +200,7 @@ Ctrl+F/Ctrl+B Scroll full page down/up
|
||||||
PageDown/PageUp Scroll full page down/up
|
PageDown/PageUp Scroll full page down/up
|
||||||
End/Home Jump to bottom/top
|
End/Home Jump to bottom/top
|
||||||
g/G Jump to top/bottom
|
g/G Jump to top/bottom
|
||||||
|
/ Search message history
|
||||||
i Switch to INSERT
|
i Switch to INSERT
|
||||||
: Enter COMMAND mode
|
: Enter COMMAND mode
|
||||||
? Open full key reference
|
? Open full key reference
|
||||||
|
|
@ -219,6 +222,7 @@ l l.
|
||||||
:last [\fIN\fR] Show last N messages from history (1\-50, default 10)
|
:last [\fIN\fR] Show last N messages from history (1\-50, default 10)
|
||||||
:search \fIkeyword\fR Case\-insensitive search across full message history
|
:search \fIkeyword\fR Case\-insensitive search across full message history
|
||||||
:mute\-joins Toggle join/leave system notifications on/off
|
:mute\-joins Toggle join/leave system notifications on/off
|
||||||
|
:lang Show current UI language
|
||||||
:lang \fIen|zh\fR Switch UI language for this session
|
:lang \fIen|zh\fR Switch UI language for this session
|
||||||
:help Show concise manual
|
:help Show concise manual
|
||||||
:clear Clear command output
|
:clear Clear command output
|
||||||
|
|
@ -227,12 +231,23 @@ Up/Down Browse command history
|
||||||
ESC Cancel and return to NORMAL
|
ESC Cancel and return to NORMAL
|
||||||
.TE
|
.TE
|
||||||
.PP
|
.PP
|
||||||
Command output pages use j/k, Ctrl+D/Ctrl+U, and g/G for paging.
|
Command output pages use the same paging keys as the help screen.
|
||||||
|
.TS
|
||||||
|
l l.
|
||||||
|
q, ESC Close output
|
||||||
|
j/k, arrows Scroll down/up
|
||||||
|
Ctrl+D/Ctrl+U Scroll half page down/up
|
||||||
|
Ctrl+F/Ctrl+B Scroll full page down/up
|
||||||
|
Space/b Scroll full page down/up
|
||||||
|
PageDown/PageUp Scroll full page down/up
|
||||||
|
End/Home Jump to bottom/top
|
||||||
|
g/G Jump to top/bottom
|
||||||
|
r Refresh live output (:inbox)
|
||||||
|
.TE
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.B :inbox
|
.B :inbox
|
||||||
page can also be refreshed with
|
page refreshes automatically when a new private message arrives while it is
|
||||||
.B r
|
|
||||||
and refreshes automatically when a new private message arrives while it is
|
|
||||||
open.
|
open.
|
||||||
.SH EXEC INTERFACE
|
.SH EXEC INTERFACE
|
||||||
Commands can be run non\-interactively for scripting:
|
Commands can be run non\-interactively for scripting:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue