commit 5e070240dfc4a9ff80bb9789bc54b22b77db6306 from: Stefan Sperling date: Sat Jun 22 19:06:35 2019 UTC make default usage fit on one line; de-duplicates man page info commit - 4eec20aa4d575af46bdd2d4e6a0876872c309fc4 commit + 5e070240dfc4a9ff80bb9789bc54b22b77db6306 blob - 3efedf2e0388342609962a04aee6acb6aa014599 blob + 8787eff3dc915827732a1e6e2f48996dbab376a6 --- got/got.c +++ got/got.c @@ -70,7 +70,6 @@ struct cmd { const char *cmd_name; const struct got_error *(*cmd_main)(int, char *[]); void (*cmd_usage)(void); - const char *cmd_descr; }; __dead static void usage(void); @@ -107,36 +106,21 @@ static const struct got_error* cmd_cherrypick(int, ch static const struct got_error* cmd_backout(int, char *[]); static struct cmd got_commands[] = { - { "init", cmd_init, usage_init, - "create a new empty repository" }, - { "checkout", cmd_checkout, usage_checkout, - "check out a new work tree from a repository" }, - { "update", cmd_update, usage_update, - "update a work tree to a different commit" }, - { "log", cmd_log, usage_log, - "show repository history" }, - { "diff", cmd_diff, usage_diff, - "compare files and directories" }, - { "blame", cmd_blame, usage_blame, - "show when lines in a file were changed" }, - { "tree", cmd_tree, usage_tree, - "list files and directories in repository" }, - { "status", cmd_status, usage_status, - "show modification status of files" }, - { "ref", cmd_ref, usage_ref, - "manage references in repository" }, - { "add", cmd_add, usage_add, - "add new files to version control" }, - { "rm", cmd_rm, usage_rm, - "remove a versioned file" }, - { "revert", cmd_revert, usage_revert, - "revert uncommitted changes" }, - { "commit", cmd_commit, usage_commit, - "write changes from work tree to repository" }, - { "cherrypick", cmd_cherrypick, usage_cherrypick, - "merge a single commit from another branch into a work tree" }, - { "backout", cmd_backout, usage_backout, - "reverse-merge changes from a commit into a work tree" }, + { "init", cmd_init, usage_init }, + { "checkout", cmd_checkout, usage_checkout }, + { "update", cmd_update, usage_update }, + { "log", cmd_log, usage_log }, + { "diff", cmd_diff, usage_diff }, + { "blame", cmd_blame, usage_blame }, + { "tree", cmd_tree, usage_tree }, + { "status", cmd_status, usage_status }, + { "ref", cmd_ref, usage_ref }, + { "add", cmd_add, usage_add }, + { "rm", cmd_rm, usage_rm }, + { "revert", cmd_revert, usage_revert }, + { "commit", cmd_commit, usage_commit }, + { "cherrypick", cmd_cherrypick, usage_cherrypick }, + { "backout", cmd_backout, usage_backout }, }; int @@ -197,14 +181,7 @@ main(int argc, char *argv[]) __dead static void usage(void) { - int i; - - fprintf(stderr, "usage: %s [-h] command [arg ...]\n\n" - "Available commands:\n", getprogname()); - for (i = 0; i < nitems(got_commands); i++) { - struct cmd *cmd = &got_commands[i]; - fprintf(stderr, " %s: %s\n", cmd->cmd_name, cmd->cmd_descr); - } + fprintf(stderr, "usage: %s [-h] command [arg ...]\n", getprogname()); exit(1); } blob - 49ba8f0171d0e2b8526f68d428d2434385fc489b blob + 5aed76e3488a03cbbd52d854c272deb3cd5308e6 --- tog/tog.c +++ tog/tog.c @@ -69,7 +69,6 @@ struct tog_cmd { const char *name; const struct got_error *(*cmd_main)(int, char *[]); void (*cmd_usage)(void); - const char *descr; }; __dead static void usage(void); @@ -84,14 +83,10 @@ static const struct got_error* cmd_blame(int, char *[] static const struct got_error* cmd_tree(int, char *[]); static struct tog_cmd tog_commands[] = { - { "log", cmd_log, usage_log, - "show repository history" }, - { "diff", cmd_diff, usage_diff, - "compare files and directories" }, - { "blame", cmd_blame, usage_blame, - "show line-by-line file history" }, - { "tree", cmd_tree, usage_tree, - "browse trees in repository" }, + { "log", cmd_log, usage_log }, + { "diff", cmd_diff, usage_diff }, + { "blame", cmd_blame, usage_blame }, + { "tree", cmd_tree, usage_tree }, }; enum tog_view_type { @@ -4332,14 +4327,7 @@ done: __dead static void usage(void) { - int i; - - fprintf(stderr, "usage: %s [-h] [command] [arg ...]\n\n" - "Available commands:\n", getprogname()); - for (i = 0; i < nitems(tog_commands); i++) { - struct tog_cmd *cmd = &tog_commands[i]; - fprintf(stderr, " %s: %s\n", cmd->name, cmd->descr); - } + fprintf(stderr, "usage: %s [-h] [command] [arg ...]\n", getprogname()); exit(1); }