1
0
mirror of https://github.com/tmux/tmux.git synced 2025-04-01 21:41:44 +00:00

Fix documentation around optional arguments

This includes:

  - Syncing between the usage string in code and in the manpage
  - Adding optional arguments that were simply not mentioned (e.g.
    shell-command arguments)
  - Adding square brackets around arguments that are actually optional

Co-authored-by: Julian Prein <julian@druck.dev>
This commit is contained in:
Julian Prein 2025-03-20 23:04:28 +01:00
parent 3eb93383a3
commit b9956c06ae
No known key found for this signature in database
GPG Key ID: CA6B3A516FAC2555
11 changed files with 32 additions and 26 deletions

View File

@ -38,7 +38,7 @@ const struct cmd_entry cmd_bind_key_entry = {
.args = { "nrN:T:", 1, -1, cmd_bind_key_args_parse }, .args = { "nrN:T:", 1, -1, cmd_bind_key_args_parse },
.usage = "[-nr] [-T key-table] [-N note] key " .usage = "[-nr] [-T key-table] [-N note] key "
"[command [arguments]]", "[command [argument ...]]",
.flags = CMD_AFTERHOOK, .flags = CMD_AFTERHOOK,
.exec = cmd_bind_key_exec .exec = cmd_bind_key_exec

View File

@ -42,7 +42,7 @@ const struct cmd_entry cmd_display_menu_entry = {
.usage = "[-MO] [-b border-lines] [-c target-client] " .usage = "[-MO] [-b border-lines] [-c target-client] "
"[-C starting-choice] [-H selected-style] [-s style] " "[-C starting-choice] [-H selected-style] [-s style] "
"[-S border-style] " CMD_TARGET_PANE_USAGE " [-T title] " "[-S border-style] " CMD_TARGET_PANE_USAGE " [-T title] "
"[-x position] [-y position] name key command ...", "[-x position] [-y position] name [key] [command] ...",
.target = { 't', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 },
@ -59,7 +59,7 @@ const struct cmd_entry cmd_display_popup_entry = {
"[-d start-directory] [-e environment] [-h height] " "[-d start-directory] [-e environment] [-h height] "
"[-s style] [-S border-style] " CMD_TARGET_PANE_USAGE "[-s style] [-S border-style] " CMD_TARGET_PANE_USAGE
" [-T title] [-w width] [-x position] [-y position] " " [-T title] [-w width] [-x position] [-y position] "
"[shell-command]", "[shell-command [argument ...]]",
.target = { 't', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 },

View File

@ -43,7 +43,7 @@ const struct cmd_entry cmd_new_session_entry = {
.usage = "[-AdDEPX] [-c start-directory] [-e environment] [-F format] " .usage = "[-AdDEPX] [-c start-directory] [-e environment] [-F format] "
"[-f flags] [-n window-name] [-s session-name] " "[-f flags] [-n window-name] [-s session-name] "
CMD_TARGET_SESSION_USAGE " [-x width] [-y height] " CMD_TARGET_SESSION_USAGE " [-x width] [-y height] "
"[shell-command]", "[shell-command [argument ...]]",
.target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL }, .target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },

View File

@ -40,7 +40,8 @@ const struct cmd_entry cmd_new_window_entry = {
.args = { "abc:de:F:kn:PSt:", 0, -1, NULL }, .args = { "abc:de:F:kn:PSt:", 0, -1, NULL },
.usage = "[-abdkPS] [-c start-directory] [-e environment] [-F format] " .usage = "[-abdkPS] [-c start-directory] [-e environment] [-F format] "
"[-n window-name] " CMD_TARGET_WINDOW_USAGE " [shell-command]", "[-n window-name] " CMD_TARGET_WINDOW_USAGE
" [shell-command [argument ...]]",
.target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX }, .target = { 't', CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX },

View File

@ -36,7 +36,7 @@ const struct cmd_entry cmd_respawn_pane_entry = {
.args = { "c:e:kt:", 0, -1, NULL }, .args = { "c:e:kt:", 0, -1, NULL },
.usage = "[-k] [-c start-directory] [-e environment] " .usage = "[-k] [-c start-directory] [-e environment] "
CMD_TARGET_PANE_USAGE " [shell-command]", CMD_TARGET_PANE_USAGE " [shell-command [argument ...]]",
.target = { 't', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 },

View File

@ -36,7 +36,7 @@ const struct cmd_entry cmd_respawn_window_entry = {
.args = { "c:e:kt:", 0, -1, NULL }, .args = { "c:e:kt:", 0, -1, NULL },
.usage = "[-k] [-c start-directory] [-e environment] " .usage = "[-k] [-c start-directory] [-e environment] "
CMD_TARGET_WINDOW_USAGE " [shell-command]", CMD_TARGET_WINDOW_USAGE " [shell-command [argument ...]]",
.target = { 't', CMD_FIND_WINDOW, 0 }, .target = { 't', CMD_FIND_WINDOW, 0 },

View File

@ -35,7 +35,7 @@ const struct cmd_entry cmd_send_keys_entry = {
.args = { "c:FHKlMN:Rt:X", 0, -1, NULL }, .args = { "c:FHKlMN:Rt:X", 0, -1, NULL },
.usage = "[-FHKlMRX] [-c target-client] [-N repeat-count] " .usage = "[-FHKlMRX] [-c target-client] [-N repeat-count] "
CMD_TARGET_PANE_USAGE " key ...", CMD_TARGET_PANE_USAGE " [key ...]",
.target = { 't', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 },

View File

@ -35,7 +35,7 @@ const struct cmd_entry cmd_set_buffer_entry = {
.args = { "ab:t:n:w", 0, 1, NULL }, .args = { "ab:t:n:w", 0, 1, NULL },
.usage = "[-aw] " CMD_BUFFER_USAGE " [-n new-buffer-name] " .usage = "[-aw] " CMD_BUFFER_USAGE " [-n new-buffer-name] "
CMD_TARGET_CLIENT_USAGE " data", CMD_TARGET_CLIENT_USAGE " [data]",
.flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG|CMD_CLIENT_CANFAIL, .flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG|CMD_CLIENT_CANFAIL,
.exec = cmd_set_buffer_exec .exec = cmd_set_buffer_exec

View File

@ -65,7 +65,7 @@ const struct cmd_entry cmd_show_hooks_entry = {
.alias = NULL, .alias = NULL,
.args = { "gpt:w", 0, 1, NULL }, .args = { "gpt:w", 0, 1, NULL },
.usage = "[-gpw] " CMD_TARGET_PANE_USAGE, .usage = "[-gpw] " CMD_TARGET_PANE_USAGE " [hook]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL }, .target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },

View File

@ -42,7 +42,7 @@ const struct cmd_entry cmd_split_window_entry = {
.args = { "bc:de:fF:hIl:p:Pt:vZ", 0, -1, NULL }, .args = { "bc:de:fF:hIl:p:Pt:vZ", 0, -1, NULL },
.usage = "[-bdefhIPvZ] [-c start-directory] [-e environment] " .usage = "[-bdefhIPvZ] [-c start-directory] [-e environment] "
"[-F format] [-l size] " CMD_TARGET_PANE_USAGE "[-F format] [-l size] " CMD_TARGET_PANE_USAGE
" [shell-command]", " [shell-command [argument ...]]",
.target = { 't', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 },

35
tmux.1
View File

@ -1247,7 +1247,7 @@ Lock all clients attached to
.Op Fl t Ar group-name .Op Fl t Ar group-name
.Op Fl x Ar width .Op Fl x Ar width
.Op Fl y Ar height .Op Fl y Ar height
.Op Ar shell-command .Op Ar shell-command Op Ar argument ...
.Xc .Xc
.D1 Pq alias: Ic new .D1 Pq alias: Ic new
Create a new session with name Create a new session with name
@ -3088,7 +3088,7 @@ option.
.Op Fl F Ar format .Op Fl F Ar format
.Op Fl n Ar window-name .Op Fl n Ar window-name
.Op Fl t Ar target-window .Op Fl t Ar target-window
.Op Ar shell-command .Op Ar shell-command Op Ar argument ...
.Xc .Xc
.D1 Pq alias: Ic neww .D1 Pq alias: Ic neww
Create a new window. Create a new window.
@ -3336,7 +3336,7 @@ to manual in the window options.
.Op Fl c Ar start-directory .Op Fl c Ar start-directory
.Op Fl e Ar environment .Op Fl e Ar environment
.Op Fl t Ar target-pane .Op Fl t Ar target-pane
.Op Ar shell-command .Op Ar shell-command Op Ar argument ...
.Xc .Xc
.D1 Pq alias: Ic respawnp .D1 Pq alias: Ic respawnp
Reactivate a pane in which the command has exited (see the Reactivate a pane in which the command has exited (see the
@ -3362,7 +3362,7 @@ command.
.Op Fl c Ar start-directory .Op Fl c Ar start-directory
.Op Fl e Ar environment .Op Fl e Ar environment
.Op Fl t Ar target-window .Op Fl t Ar target-window
.Op Ar shell-command .Op Ar shell-command Op Ar argument ...
.Xc .Xc
.D1 Pq alias: Ic respawnw .D1 Pq alias: Ic respawnw
Reactivate a window in which the command has exited (see the Reactivate a window in which the command has exited (see the
@ -3490,10 +3490,10 @@ the command behaves like
.Op Fl bdfhIvPZ .Op Fl bdfhIvPZ
.Op Fl c Ar start-directory .Op Fl c Ar start-directory
.Op Fl e Ar environment .Op Fl e Ar environment
.Op Fl F Ar format
.Op Fl l Ar size .Op Fl l Ar size
.Op Fl t Ar target-pane .Op Fl t Ar target-pane
.Op Ar shell-command .Op Ar shell-command Op Ar argument ...
.Op Fl F Ar format
.Xc .Xc
.D1 Pq alias: Ic splitw .D1 Pq alias: Ic splitw
Create a new pane by splitting Create a new pane by splitting
@ -3673,7 +3673,8 @@ Commands related to key bindings are as follows:
.Op Fl nr .Op Fl nr
.Op Fl N Ar note .Op Fl N Ar note
.Op Fl T Ar key-table .Op Fl T Ar key-table
.Ar key command Op Ar argument ... .Ar key
.Op Ar command Op Ar argument ...
.Xc .Xc
.D1 Pq alias: Ic bind .D1 Pq alias: Ic bind
Bind key Bind key
@ -3732,7 +3733,8 @@ command.
.Tg lsk .Tg lsk
.It Xo Ic list-keys .It Xo Ic list-keys
.Op Fl 1aN .Op Fl 1aN
.Op Fl P Ar prefix-string Fl T Ar key-table .Op Fl P Ar prefix-string
.Op Fl T Ar key-table
.Op Ar key .Op Ar key
.Xc .Xc
.D1 Pq alias: Ic lsk .D1 Pq alias: Ic lsk
@ -3771,7 +3773,7 @@ lists the command for keys that do not have a note rather than skipping them.
.Op Fl c Ar target-client .Op Fl c Ar target-client
.Op Fl N Ar repeat-count .Op Fl N Ar repeat-count
.Op Fl t Ar target-pane .Op Fl t Ar target-pane
.Ar key ... .Op Ar key ...
.Xc .Xc
.D1 Pq alias: Ic send .D1 Pq alias: Ic send
Send a key or keys to a window or client. Send a key or keys to a window or client.
@ -3924,7 +3926,8 @@ Commands which set options are as follows:
.It Xo Ic set-option .It Xo Ic set-option
.Op Fl aFgopqsuUw .Op Fl aFgopqsuUw
.Op Fl t Ar target-pane .Op Fl t Ar target-pane
.Ar option Ar value .Ar option
.Op Ar value
.Xc .Xc
.D1 Pq alias: Ic set .D1 Pq alias: Ic set
Set a pane option with Set a pane option with
@ -5460,7 +5463,7 @@ Hooks are managed with these commands:
.Op Fl agpRuw .Op Fl agpRuw
.Op Fl t Ar target-pane .Op Fl t Ar target-pane
.Ar hook-name .Ar hook-name
.Ar command .Op Ar command
.Xc .Xc
Without Without
.Fl R , .Fl R ,
@ -5481,6 +5484,7 @@ immediately.
.It Xo Ic show-hooks .It Xo Ic show-hooks
.Op Fl gpw .Op Fl gpw
.Op Fl t Ar target-pane .Op Fl t Ar target-pane
.Op Ar hook
.Xc .Xc
Shows hooks. Shows hooks.
The flags are the same as for The flags are the same as for
@ -6651,8 +6655,9 @@ the default is
.Op Fl x Ar position .Op Fl x Ar position
.Op Fl y Ar position .Op Fl y Ar position
.Ar name .Ar name
.Ar key .Op Ar key
.Ar command Op Ar argument ... .Op Ar command
.Ar ...
.Xc .Xc
.D1 Pq alias: Ic menu .D1 Pq alias: Ic menu
Display a menu on Display a menu on
@ -6825,7 +6830,7 @@ forwards any input read from stdin to the empty pane given by
.Op Fl w Ar width .Op Fl w Ar width
.Op Fl x Ar position .Op Fl x Ar position
.Op Fl y Ar position .Op Fl y Ar position
.Op Ar shell-command .Op Ar shell-command Op Ar argument ...
.Xc .Xc
.D1 Pq alias: Ic popup .D1 Pq alias: Ic popup
Display a popup running Display a popup running
@ -7126,7 +7131,7 @@ the contents are written to stdout.
.Op Fl t Ar target-client .Op Fl t Ar target-client
.Tg setb .Tg setb
.Op Fl n Ar new-buffer-name .Op Fl n Ar new-buffer-name
.Ar data .Op Ar data
.Xc .Xc
.D1 Pq alias: Ic setb .D1 Pq alias: Ic setb
Set the contents of the specified buffer to Set the contents of the specified buffer to