summaryrefslogtreecommitdiff
path: root/makeself-help-script.c
diff options
context:
space:
mode:
Diffstat (limited to 'makeself-help-script.c')
-rw-r--r--makeself-help-script.c35
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;
}