1
0
Fork 0
forked from murx/murx

Add short aliases for all command-line options

This commit is contained in:
Johannes Findeisen 2026-11-23 18:16:04 +01:00
commit 71517ec246
4 changed files with 36 additions and 33 deletions

View file

@ -14,16 +14,16 @@ make
./murx --prefix x work # same as -p x ./murx --prefix x work # same as -p x
./murx -s bottom work # show the session status line at the bottom ./murx -s bottom work # show the session status line at the bottom
./murx --status bottom work # same as -s bottom ./murx --status bottom work # same as -s bottom
./murx --cwd work # show the current directory in the status bar ./murx -d work # --cwd, show the current directory in the status bar
./murx --murx work # show [murx] on the left of the status bar ./murx -m work # --murx, show [murx] on the left of the status bar
./murx -c 191a1c work # use a grey status bar background ./murx -c 191a1c work # use a grey status bar background
./murx --history 10000 work # keep up to 10,000 history lines per pane ./murx -H 10000 work # --history, keep up to 10,000 history lines per pane
./murx --clock work # show the status bar clock ./murx -C work # --clock, show the status bar clock
./murx --hostname work # show the hostname: prefix in window titles ./murx -n work # --hostname, show the hostname: prefix in window titles
./murx --titles work # show a title row above each pane ./murx -t work # --titles, show a title row above each pane
./murx -l, --list-sessions # list running sessions without attaching ./murx -l # --list-sessions, list running sessions without attaching
./murx --help # logo, version, usage and shortcuts ./murx -h # --help, logo, version, usage and shortcuts
./murx -v, --version # print the version and exit ./murx -v # --version, print the version and exit
``` ```
Detach with `Ctrl-A d`. Run `murx` again to reattach. Detach with `Ctrl-A d`. Run `murx` again to reattach.

View file

@ -1,5 +1,8 @@
# Unreleased # Unreleased
- Added short options for `--history` (`-H`), `--cwd` (`-d`),
`--clock` (`-C`), `--murx` (`-m`), `--hostname` (`-n`), and
`--titles` (`-t`).
- Renamed `--pane-titles` to `--titles`. - Renamed `--pane-titles` to `--titles`.
# murx 1.0.3 released # murx 1.0.3 released

24
murx.1
View file

@ -6,12 +6,12 @@ murx \- small persistent terminal multiplexer
.RB [ \-p " letter"] .RB [ \-p " letter"]
.RB [ \-s " top|bottom"] .RB [ \-s " top|bottom"]
.RB [ \-c " RRGGBB"] .RB [ \-c " RRGGBB"]
.RB [ \-\-history " lines"] .RB [ \-H " lines"]
.RB [ \-\-cwd ] .RB [ \-d ]
.RB [ \-\-clock ] .RB [ \-C ]
.RB [ \-\-murx ] .RB [ \-m ]
.RB [ \-\-hostname ] .RB [ \-n ]
.RB [ \-\-titles ] .RB [ \-t ]
.RB [ \-\- ] .RB [ \-\- ]
.RI [ session ] .RI [ session ]
.br .br
@ -46,7 +46,7 @@ hyphens or underscores. Use
before a name beginning with a hyphen. before a name beginning with a hyphen.
.SH OPTIONS .SH OPTIONS
.TP .TP
.BR \-\-history " lines" .BR \-H ", " \-\-history " lines"
Set the maximum number of normal-screen history lines retained per pane Set the maximum number of normal-screen history lines retained per pane
in a new session. Accepts 0 to 100,000, with 0 disabling history retention. in a new session. Accepts 0 to 100,000, with 0 disabling history retention.
Reattaching preserves the existing session's limit. Reattaching preserves the existing session's limit.
@ -78,21 +78,21 @@ Supply six hexadecimal digits, such as 000000 for black.
Omitting this option preserves the session's color when reattaching. New Omitting this option preserves the session's color when reattaching. New
sessions use the terminal's default background unless a color is supplied. sessions use the terminal's default background unless a color is supplied.
.TP .TP
.B \-\-cwd .BR \-d ", " \-\-cwd
Show the current directory at the left of the status line. Show the current directory at the left of the status line.
.TP .TP
.B \-\-clock .BR \-C ", " \-\-clock
Show the status clock. Show the status clock.
.TP .TP
.B \-\-murx .BR \-m ", " \-\-murx
Show the [murx] label at the left of the status line when Show the [murx] label at the left of the status line when
.B \-\-cwd .B \-\-cwd
is not enabled. The directory takes precedence if both options are supplied. is not enabled. The directory takes precedence if both options are supplied.
.TP .TP
.B \-\-hostname .BR \-n ", " \-\-hostname
Show the hostname: prefix in window names and the outer terminal title. Show the hostname: prefix in window names and the outer terminal title.
.TP .TP
.B \-\-titles .BR \-t ", " \-\-titles
Show the title row above each pane. Pane titles are off by default. Show the title row above each pane. Pane titles are off by default.
.TP .TP
.BR \-h ", " \-\-help .BR \-h ", " \-\-help

24
murx.c
View file

@ -4989,12 +4989,12 @@ static void print_help(FILE *out) {
snprintf(history_help, sizeof history_help, snprintf(history_help, sizeof history_help,
"history lines per pane in new sessions (0-%d, default: %d)", "history lines per pane in new sessions (0-%d, default: %d)",
MAX_HISTORY_LINES, DEFAULT_HISTORY_LINES); MAX_HISTORY_LINES, DEFAULT_HISTORY_LINES);
help_row(out, "--history LINES", history_help); help_row(out, "-H, --history LINES", history_help);
help_row(out, "--cwd", "show current directory in status bar"); help_row(out, "-d, --cwd", "show current directory in status bar");
help_row(out, "--clock", "show clock in status bar"); help_row(out, "-C, --clock", "show clock in status bar");
help_row(out, "--murx", "show [murx] in status bar unless --cwd is set"); help_row(out, "-m, --murx", "show [murx] in status bar unless --cwd is set");
help_row(out, "--hostname", "show hostname: prefix in window titles"); help_row(out, "-n, --hostname", "show hostname: prefix in window titles");
help_row(out, "--titles", "show the title row above each pane (default: off)"); help_row(out, "-t, --titles", "show the title row above each pane (default: off)");
fputs("\n" fputs("\n"
"Without -s or -c, an existing session keeps its position and color.\n" "Without -s or -c, an existing session keeps its position and color.\n"
@ -5076,7 +5076,7 @@ int main(int argc, char **argv) {
} }
if (strcmp(option, "-l") == 0 || strcmp(option, "--list-sessions") == 0) { if (strcmp(option, "-l") == 0 || strcmp(option, "--list-sessions") == 0) {
list = 1; list = 1;
} else if (strcmp(option, "--history") == 0) { } else if (strcmp(option, "-H") == 0 || strcmp(option, "--history") == 0) {
const char *value = argi < argc ? argv[argi] : ""; const char *value = argi < argc ? argv[argi] : "";
char *end; char *end;
long lines = strtol(value, &end, 10); long lines = strtol(value, &end, 10);
@ -5087,15 +5087,15 @@ int main(int argc, char **argv) {
} }
history_limit = (int)lines; history_limit = (int)lines;
argi++; argi++;
} else if (strcmp(option, "--cwd") == 0) { } else if (strcmp(option, "-d") == 0 || strcmp(option, "--cwd") == 0) {
display.show_cwd = 1; display.show_cwd = 1;
} else if (strcmp(option, "--clock") == 0) { } else if (strcmp(option, "-C") == 0 || strcmp(option, "--clock") == 0) {
display.show_clock = 1; display.show_clock = 1;
} else if (strcmp(option, "--murx") == 0) { } else if (strcmp(option, "-m") == 0 || strcmp(option, "--murx") == 0) {
display.show_murx = 1; display.show_murx = 1;
} else if (strcmp(option, "--hostname") == 0) { } else if (strcmp(option, "-n") == 0 || strcmp(option, "--hostname") == 0) {
display.show_hostname = 1; display.show_hostname = 1;
} else if (strcmp(option, "--titles") == 0) { } else if (strcmp(option, "-t") == 0 || strcmp(option, "--titles") == 0) {
display.show_pane_titles = 1; display.show_pane_titles = 1;
} else if (strcmp(option, "-p") == 0 || strcmp(option, "--prefix") == 0) { } else if (strcmp(option, "-p") == 0 || strcmp(option, "--prefix") == 0) {
if (argi >= argc || !parse_prefix(argv[argi], &prefix)) { if (argi >= argc || !parse_prefix(argv[argi], &prefix)) {