Merge pull request #43 from m1ngsama/docs/update-help-and-docs

Update all user-facing help text and documentation
This commit is contained in:
m1ngsama 2026-04-19 22:11:17 +08:00 committed by GitHub
commit 6dfcfe0487
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 60 additions and 50 deletions

View file

@ -68,19 +68,32 @@ Ctrl+C - Enter NORMAL mode
``` ```
i - Return to INSERT mode i - Return to INSERT mode
: - Enter COMMAND mode : - Enter COMMAND mode
j/k - Scroll down/up j/k - Scroll down/up one line
g/G - Scroll to top/bottom Ctrl+D/U - Scroll half page down/up
Ctrl+F/B - Scroll full page down/up
g/G - Jump to top/bottom
? - Show help ? - Show help
Ctrl+C - Exit chat
``` ```
**COMMAND mode** **COMMAND mode**
``` ```
:list, :users, :who - Show online users :list, :users - Show online users
:help, :commands - Show available commands :nick <name> - Change nickname
:clear, :cls - Clear command output :msg <user> <text> - Whisper to user
:w <user> <text> - Short alias for :msg
:help - Show available commands
:clear - Clear command output
:q, :quit, :exit - Disconnect
Up/Down - Browse command history
ESC - Return to NORMAL mode ESC - Return to NORMAL mode
``` ```
**Special messages (INSERT mode)**
```
/me <action> - Send action (e.g. /me waves)
```
### Security Configuration ### Security Configuration
**Access control:** **Access control:**
@ -143,6 +156,7 @@ ssh -p 2222 chat.m1ng.space stats --json
ssh -p 2222 chat.m1ng.space users ssh -p 2222 chat.m1ng.space users
ssh -p 2222 chat.m1ng.space "tail -n 20" ssh -p 2222 chat.m1ng.space "tail -n 20"
ssh -p 2222 operator@chat.m1ng.space post "service notice" ssh -p 2222 operator@chat.m1ng.space post "service notice"
ssh -p 2222 chat.m1ng.space post "/me deploys v2.0"
``` ```
## Development ## Development

View file

@ -762,6 +762,7 @@ static int exec_command_help(client_t *client) {
" tail [N] Print recent messages\n" " tail [N] Print recent messages\n"
" tail -n N Print recent messages\n" " tail -n N Print recent messages\n"
" post MESSAGE Post a message non-interactively\n" " post MESSAGE Post a message non-interactively\n"
" post \"/me act\" Post an action message\n"
" exit Exit successfully\n"; " exit Exit successfully\n";
return client_send(client, help_text, sizeof(help_text) - 1) == 0 ? 0 : 1; return client_send(client, help_text, sizeof(help_text) - 1) == 0 ? 0 : 1;
@ -1153,7 +1154,7 @@ static void execute_command(client_t *client) {
} else if (strcmp(cmd, "help") == 0 || strcmp(cmd, "commands") == 0) { } else if (strcmp(cmd, "help") == 0 || strcmp(cmd, "commands") == 0) {
buffer_appendf(output, sizeof(output), &pos, buffer_appendf(output, sizeof(output), &pos,
"========================================\n" "========================================\n"
" Available Commands\n" " Available Commands / 可用命令\n"
"========================================\n" "========================================\n"
"list, users, who - Show online users\n" "list, users, who - Show online users\n"
"nick/name <name> - Change nickname\n" "nick/name <name> - Change nickname\n"
@ -1162,6 +1163,9 @@ static void execute_command(client_t *client) {
"clear, cls - Clear command output\n" "clear, cls - Clear command output\n"
"q, quit, exit - Disconnect\n" "q, quit, exit - Disconnect\n"
"Up/Down arrows - Command history\n" "Up/Down arrows - Command history\n"
"========================================\n"
"In INSERT mode:\n"
" /me <action> - Send action message\n"
"========================================\n"); "========================================\n");
} else if (strncmp(cmd, "msg ", 4) == 0 || strncmp(cmd, "w ", 2) == 0) { } else if (strncmp(cmd, "msg ", 4) == 0 || strncmp(cmd, "w ", 2) == 0) {

View file

@ -299,35 +299,30 @@ const char* tui_get_help_text(help_lang_t lang) {
"NORMAL MODE KEYS:\n" "NORMAL MODE KEYS:\n"
" i - Return to INSERT mode\n" " i - Return to INSERT mode\n"
" : - Enter COMMAND mode\n" " : - Enter COMMAND mode\n"
" j - Scroll down (older messages)\n" " j/k - Scroll down/up one line\n"
" k - Scroll up (newer messages)\n" " Ctrl+D/U - Scroll half page down/up\n"
" g - Jump to top (oldest)\n" " Ctrl+F/B - Scroll full page down/up\n"
" G - Jump to bottom (newest)\n" " g/G - Jump to top/bottom\n"
" ? - Show this help\n" " ? - Show this help\n"
" Ctrl+C - Exit chat\n" " Ctrl+C - Exit chat\n"
"\n" "\n"
"COMMAND MODE KEYS:\n"
" Enter - Execute command\n"
" ESC - Cancel, return to NORMAL\n"
" Backspace - Delete character\n"
" Ctrl+W - Delete last word\n"
" Ctrl+U - Delete line\n"
"\n"
"AVAILABLE COMMANDS:\n" "AVAILABLE COMMANDS:\n"
" list, users, who - Show online users\n" " :list, :users - Show online users\n"
" nick/name <name> - Change nickname\n" " :nick <name> - Change nickname\n"
" msg/w <user> <text> - Whisper to user\n" " :msg <user> <text> - Whisper to user\n"
" help, commands - Show available commands\n" " :w <user> <text> - Short alias for :msg\n"
" clear, cls - Clear command output\n" " :help - Show available commands\n"
" :clear - Clear command output\n"
" :q, :quit, :exit - Disconnect\n"
"\n"
"SPECIAL MESSAGES:\n"
" /me <action> - Send action (e.g. /me waves)\n"
"\n" "\n"
"HELP SCREEN KEYS:\n" "HELP SCREEN KEYS:\n"
" q, ESC - Close help\n" " q, ESC - Close help\n"
" j - Scroll down\n" " j/k - Scroll down/up\n"
" k - Scroll up\n" " g/G - Jump to top/bottom\n"
" g - Jump to top\n" " e/z - Switch English/Chinese\n";
" G - Jump to bottom\n"
" e, E - Switch to English\n"
" z, Z - Switch to Chinese\n";
} else { } else {
return "终端聊天室 - 帮助\n" return "终端聊天室 - 帮助\n"
"\n" "\n"
@ -347,35 +342,30 @@ const char* tui_get_help_text(help_lang_t lang) {
"NORMAL 模式按键:\n" "NORMAL 模式按键:\n"
" i - 返回 INSERT 模式\n" " i - 返回 INSERT 模式\n"
" : - 进入 COMMAND 模式\n" " : - 进入 COMMAND 模式\n"
" j - 向下滚动(更早的消息)\n" " j/k - 向下/上滚动一行\n"
" k - 向上滚动(更新的消息)\n" " Ctrl+D/U - 向下/上滚动半页\n"
" g - 跳到顶部(最早)\n" " Ctrl+F/B - 向下/上滚动整页\n"
" G - 跳到底部(最新)\n" " g/G - 跳到顶部/底部\n"
" ? - 显示此帮助\n" " ? - 显示此帮助\n"
" Ctrl+C - 退出聊天\n" " Ctrl+C - 退出聊天\n"
"\n" "\n"
"COMMAND 模式按键:\n"
" Enter - 执行命令\n"
" ESC - 取消,返回 NORMAL 模式\n"
" Backspace - 删除字符\n"
" Ctrl+W - 删除上个单词\n"
" Ctrl+U - 删除整行\n"
"\n"
"可用命令:\n" "可用命令:\n"
" list, users, who - 显示在线用户\n" " :list, :users - 显示在线用户\n"
" nick/name <名字> - 更改昵称\n" " :nick <名字> - 更改昵称\n"
" msg/w <用户> <文本> - 私聊\n" " :msg <用户> <文本> - 私聊\n"
" help, commands - 显示可用命令\n" " :w <用户> <文本> - :msg 的简写\n"
" clear, cls - 清空命令输出\n" " :help - 显示可用命令\n"
" :clear - 清空命令输出\n"
" :q, :quit, :exit - 断开连接\n"
"\n"
"特殊消息:\n"
" /me <动作> - 发送动作 (如 /me 挥手)\n"
"\n" "\n"
"帮助界面按键:\n" "帮助界面按键:\n"
" q, ESC - 关闭帮助\n" " q, ESC - 关闭帮助\n"
" j - 向下滚动\n" " j/k - 向下/上滚动\n"
" k - 向上滚动\n" " g/G - 跳到顶部/底部\n"
" g - 跳到顶部\n" " e/z - 切换英文/中文\n";
" G - 跳到底部\n"
" e, E - 切换到英文\n"
" z, Z - 切换到中文\n";
} }
} }

2
tnt.1
View file

@ -84,6 +84,7 @@ ESC Switch to NORMAL
Ctrl+W Delete last word Ctrl+W Delete last word
Ctrl+U Clear input line Ctrl+U Clear input line
Ctrl+C Switch to NORMAL Ctrl+C Switch to NORMAL
/me \fIaction\fR Send action message (e.g. /me waves)
.TE .TE
.SS NORMAL mode .SS NORMAL mode
.TS .TS
@ -120,6 +121,7 @@ ssh host \-p 2222 users \-\-json
ssh host \-p 2222 stats \-\-json ssh host \-p 2222 stats \-\-json
ssh host \-p 2222 tail 20 ssh host \-p 2222 tail 20
ssh host \-p 2222 post "Hello from a script" ssh host \-p 2222 post "Hello from a script"
ssh host \-p 2222 post "/me deploys v2.0"
ssh host \-p 2222 health ssh host \-p 2222 health
.fi .fi
.PP .PP