commit - 46a0db7da03073112aca8f07035531a96ecde431
commit + 1b6b95a858b5185349db73ced93c5f08850ba369
blob - ccb72f27598eb28ba66f1e58c05bbfe0924d612e
blob + 1a35ccf9fdfa3be6a333382ec6f7bc5395dd9f1d
--- got/got.1
+++ got/got.1
.Sh SYNOPSIS
.Nm
.Ar command
+.Op Fl h
.Op Ar arg ...
.Sh DESCRIPTION
The
repositories.
It prioritizes ease of use and simplicity over flexibility.
.Pp
+The options are as follows:
+.Bl -tag -width tenletters
+.It Fl h
+Display usage information.
+.El
+.Pp
The commands are as follows:
.Bl -tag -width Ds
.It Cm status
blob - d426e6d04c0107315313987893f8bf4e34c4f4f6
blob + bc454f6fd980a7239121ac3fa8649e9bed111ebe
--- got/got.c
+++ got/got.c
struct cmd {
const char *cmd_name;
int (*cmd_main)(int, char *[]);
+ void (*cmd_usage)(void);
const char *cmd_descr;
};
int cmd_status(int, char *[]);
struct cmd got_commands[] = {
- { "log", cmd_log, "show repository history" },
+ { "log", cmd_log, usage_log,
+ "show repository history" },
#ifdef notyet
- { "status", cmd_status, "show modification status of files" },
+ { "status", cmd_status, usage_status,
+ "show modification status of files" },
#endif
};
struct cmd *cmd;
unsigned int i;
int ch;
+ int hflag = 0;
setlocale(LC_ALL, "");
if (pledge("stdio rpath wpath cpath", NULL) == -1)
err(1, "pledge");
- while ((ch = getopt(argc, argv, "")) != -1) {
+ while ((ch = getopt(argc, argv, "h")) != -1) {
switch (ch) {
+ case 'h':
+ hflag = 1;
+ break;
default:
usage();
/* NOTREACHED */
if (strncmp(cmd->cmd_name, argv[0], strlen(argv[0])))
continue;
+ if (hflag)
+ got_commands[i].cmd_usage();
+
return got_commands[i].cmd_main(argc, argv);
/* NOTREACHED */
}
{
int i;
- fprintf(stderr, "usage: %s command [arg ...]\n\nAvailable commands:\n",
+ fprintf(stderr, "usage: %s [-h] command [arg ...]\n\nAvailable commands:\n",
getprogname());
for (i = 0; i < nitems(got_commands); i++) {
struct cmd *cmd = &got_commands[i];