diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2012-05-02 08:06:32 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2012-05-02 08:06:32 -0700 |
commit | 588f3d7f11c87965d3d19a9c8a587b329d7d20be (patch) | |
tree | 390a6a6d145d2ef4c08b95c23741a9797b4338e1 /makeself-help-script.c | |
parent | 66b1c9fff6c37fbadaa201bb96e24ba6f47b077d (diff) |
302.07302.07
Diffstat (limited to 'makeself-help-script.c')
-rw-r--r-- | makeself-help-script.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/makeself-help-script.c b/makeself-help-script.c index de28611..47f8a9a 100644 --- a/makeself-help-script.c +++ b/makeself-help-script.c @@ -9,29 +9,50 @@ #include <string.h> #include "nvidia-installer.h" -#include "help-args.h" +#include "nvgetopt.h" +#include "option_table.h" -void print_usage(char **argv) +static void print_usage(char **argv) { fprintf(stderr, "usage: %s --help-args-only|" "--advanced-options-args-only\n", argv[0]); } +static void print_help_helper(const char *name, const char *description) +{ + fmtoutp(TAB, name); + fmtoutp(BIGTAB, description); + fmtout(""); +} + int main(int argc, char **argv) { + unsigned int include_mask = 0; + if (argc != 2) { print_usage(argv); exit(1); } - if (strcmp(argv[1], "--help-args-only") == 0) - print_help_args_only(FALSE, TRUE, FALSE); - else if (strcmp(argv[1], "--advanced-options-args-only") == 0) - print_help_args_only(FALSE, TRUE, TRUE); - else { + /* + * We are printing help text for use by makeself.sh; we do not + * want this formatted to the width of the current terminal, so + * hardcode the width used by fmtout() to 65. + */ + reset_current_terminal_width(65); + + if (strcmp(argv[1], "--help-args-only") == 0) { + /* only print options with the ALWAYS flag */ + include_mask = NVGETOPT_HELP_ALWAYS; + } else if (strcmp(argv[1], "--advanced-options-args-only") == 0) { + /* print all options */ + include_mask = 0; + } else { print_usage(argv); exit(1); } + nvgetopt_print_help(__options, include_mask, print_help_helper); + return 0; } |