Skip to content

Commit

Permalink
Provide a better CLI help (-h)
Browse files Browse the repository at this point in the history
  • Loading branch information
nviennot committed Nov 6, 2019
1 parent 206c0f3 commit fa49dc9
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,18 @@ __dead void
usage(void)
{
fprintf(stderr,
"usage: %s [-vVF] [-f config-file] [-S socket-path] [command [flags]]\n",
__progname);
"Usage: %s [options] [tmux-command [flags]]\n"
"\n"
"Basic options:\n"
" -n <name> specify the session name instead of getting a random one\n"
" -r <name> same, but for the read-only session name\n"
" -k <key> specify the account-key, necessary for named sessions on tmate.io\n"
" -F set the foreground mode, useful for setting remote access\n"
" -f <path> set the config file path\n"
" -S <path> set the socket path, useful to issue commands to a running tmate instance\n"
" -v set verbosity (can be repeated)\n"
" -V print version\n"
,__progname);
exit(1);
}

Expand Down Expand Up @@ -254,7 +264,7 @@ main(int argc, char **argv)
#endif

label = path = NULL;
while ((opt = getopt(argc, argv, "2c:CdFf:lL:qS:uUVvk:n:r:a:")) != -1) {
while ((opt = getopt(argc, argv, "h2c:CdFf:lL:qS:uUVvk:n:r:a:")) != -1) {
switch (opt) {
case '2':
flags |= CLIENT_256COLOURS;
Expand Down Expand Up @@ -311,6 +321,7 @@ main(int argc, char **argv)
case 'a':
authorized_keys = xstrdup(optarg);
break;
case 'h':
default:
usage();
}
Expand Down

0 comments on commit fa49dc9

Please sign in to comment.