Merge pull request #23 from ifupdown-ng/feature/multicall-manpage-xref

add manpage xref to applet help output
This commit is contained in:
Ariadne Conill 2020-08-18 14:18:58 -06:00 committed by GitHub
commit 2c562b7be0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 0 deletions

View file

@ -329,5 +329,6 @@ struct if_applet ifquery_applet = {
.desc = "query interface configuration", .desc = "query interface configuration",
.main = ifquery_main, .main = ifquery_main,
.usage = "ifquery [options] <interfaces>\n ifquery [options] --list", .usage = "ifquery [options] <interfaces>\n ifquery [options] --list",
.manpage = "8 ifquery",
.groups = { &global_option_group, &match_option_group, &exec_option_group, &local_option_group }, .groups = { &global_option_group, &match_option_group, &exec_option_group, &local_option_group },
}; };

View file

@ -239,6 +239,7 @@ struct if_applet ifup_applet = {
.desc = "bring interfaces up", .desc = "bring interfaces up",
.main = ifupdown_main, .main = ifupdown_main,
.usage = "ifup [options] <interfaces>", .usage = "ifup [options] <interfaces>",
.manpage = "8 ifup",
.groups = { &global_option_group, &match_option_group, &exec_option_group, }, .groups = { &global_option_group, &match_option_group, &exec_option_group, },
}; };
@ -247,5 +248,6 @@ struct if_applet ifdown_applet = {
.desc = "take interfaces down", .desc = "take interfaces down",
.main = ifupdown_main, .main = ifupdown_main,
.usage = "ifdown [options] <interfaces>", .usage = "ifdown [options] <interfaces>",
.manpage = "8 ifdown",
.groups = { &global_option_group, &match_option_group, &exec_option_group, }, .groups = { &global_option_group, &match_option_group, &exec_option_group, },
}; };

View file

@ -62,6 +62,9 @@ generic_usage(const struct if_applet *applet, int result)
} }
} }
if (applet->manpage != NULL)
fprintf(stderr, "\nFor more information: man %s\n", applet->manpage);
exit(result); exit(result);
} }

View file

@ -43,6 +43,7 @@ struct if_applet {
const char *name; const char *name;
const char *desc; const char *desc;
const char *usage; const char *usage;
const char *manpage;
int (*const main)(int argc, char *argv[]); int (*const main)(int argc, char *argv[]);
const struct if_option_group *groups[16]; const struct if_option_group *groups[16];
}; };