Skip to content

Commit

Permalink
Add a CLI help mode to show hidden opts.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Dec 14, 2018
1 parent c379900 commit 6326130
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/jloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jl_options_t jl_options = { 0, // quiet
static const char usage[] = "julia [switches] -- [programfile] [args...]\n";
static const char opts[] =
" -v, --version Display version information\n"
" -h, --help Print this message\n\n"
" -h, --help Print this message (--help-hidden for more)\n\n"

// startup options
" --project[={<dir>|@.}] Set <dir> as the home project/environment\n"
Expand Down Expand Up @@ -110,7 +110,6 @@ static const char opts[] =
" --warn-overwrite={yes|no} Enable or disable method overwrite warnings\n\n"

// code generation options
//" --compile={yes|no|all|min}Enable or disable JIT compiler, or request exhaustive compilation\n"
" -C, --cpu-target <target> Limit usage of CPU features up to <target>; set to \"help\" to see the available options\n"
" -O, --optimize={0,1,2,3} Set the optimization level (default level is 2 if unspecified or 3 if used without a level)\n"
" -g, -g <level> Enable / Set the level of debug info generation"
Expand All @@ -131,17 +130,21 @@ static const char opts[] =
" Count executions of source lines (omitting setting is equivalent to \"user\")\n"
" --track-allocation={none|user|all}, --track-allocation\n"
" Count bytes allocated by each source line\n\n"
;

static const char opts_hidden[] =
// code generation options
" --compile={yes|no|all|min}Enable or disable JIT compiler, or request exhaustive compilation\n"

// compiler output options
//" --output-o name Generate an object file (including system image data)\n"
//" --output-ji name Generate a system image data file (.ji)\n"
// These are for compiler debugging purposes only and should not be otherwise
// used, so don't show them here. See the devdocs for tips on using these
// options for debugging the compiler.
// " --output-unopt-bc name Generate unoptimized LLVM bitcode (.bc)\n"
// " --output-jit-bc name Dump all IR generated by the frontend (not including system image)\n"
//" --output-bc name Generate LLVM bitcode (.bc)\n"
//" --output-incremental=no Generate an incremental output file (rather than complete)\n\n"
" --output-o name Generate an object file (including system image data)\n"
" --output-ji name Generate a system image data file (.ji)\n"

// compiler debugging (see the devdocs for tips on using these options)
" --output-unopt-bc name Generate unoptimized LLVM bitcode (.bc)\n"
" --output-jit-bc name Dump all IR generated by the frontend (not including system image)\n"
" --output-bc name Generate LLVM bitcode (.bc)\n"
" --output-incremental=no Generate an incremental output file (rather than complete)\n\n"
;

JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
Expand Down Expand Up @@ -171,6 +174,7 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
opt_use_precompiled,
opt_use_compilecache,
opt_incremental,
opt_help_hidden,
opt_banner,
opt_sysimage_native_code,
opt_compiled_modules,
Expand All @@ -184,6 +188,7 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
// with the required arguments defined in base/client.jl `process_options()`
{ "version", no_argument, 0, 'v' },
{ "help", no_argument, 0, 'h' },
{ "help-hidden", no_argument, 0, opt_help_hidden },
{ "quiet", no_argument, 0, 'q' },
{ "banner", required_argument, 0, opt_banner },
{ "home", required_argument, 0, 'H' },
Expand Down Expand Up @@ -291,6 +296,9 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
case 'h': // help
jl_printf(JL_STDOUT, "%s%s", usage, opts);
jl_exit(0);
case opt_help_hidden:
jl_printf(JL_STDOUT, "%s%s", usage, opts_hidden);
jl_exit(0);
case 'g': // debug info
if (optarg != NULL) {
if (!strcmp(optarg,"0"))
Expand Down

0 comments on commit 6326130

Please sign in to comment.