1
0
Fork 0
forked from Miroirs/x49gp

rethink commandline parameters

This commit is contained in:
Gwenhael Le Moine 2024-11-14 15:58:38 +01:00
parent 846402e9dc
commit 353bd9fa57
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 32 additions and 31 deletions

26
dist/x49gpng.scd vendored
View file

@ -50,19 +50,19 @@ Please consult HP's manual (for their official firmware) or the documentation of
# OPTIONS # OPTIONS
- *-h* *--help* print this message and exit - *-h* *--help* print this message and exit
- *--verbose* print out more information - *--verbose* print out more information
- *--datadir*[=_absolute path_] alternate datadir (default: $XDG_CONFIG_HOME/x49gpng/) - *--datadir*[=_absolute path_] alternate datadir (default: $XDG_CONFIG_HOME/x49gpng/)
- *--50g* emulate an HP 50g (default) - *--50g* emulate an HP 50g (default)
- *--49gp* emulate an HP 49g+ - *--49gp* emulate an HP 49g+
- *--newrpl-keyboard* label keyboard for newRPL - *--newrpl-keyboard* label keyboard for newRPL
- *-n* *--name*[=_name_] set alternate UI name - *-n* *--name*[=_name_] set alternate UI name
- *-t* *--font*[=_fontname_] set alternate UI font - *-f* *--font*[=_fontname_] set alternate UI font
- *-s* *--font-size*[=_X_] scale text by X (default: 3) - *-s* *--font-size*[=_X_] scale text by X (default: 3)
- *-S* *--display-scale*[=_X_] scale LCD by X (default: 2) - *-S* *--display-scale*[=_X_] scale LCD by X (default: 2)
- *-D* *--enable-debug*[=_port_] enable the debugger interface (default port: 1234) - *--enable-debug*[=_port_] enable the debugger interface (default port: 1234)
- *-d* *--debug* use along -D to also start the debugger immediately - *--debug* use along -D to also start the debugger immediately
- *-f* *--reflash*[=_firmware_] rebuild the flash using the supplied firmware (default: select one interactively) (implies -r for safety reasons) - *--reflash*[=_firmware_] rebuild the flash using the supplied firmware (default: select one interactively) (implies -r for safety reasons)
- *-F* *--reflash-full* use along -f to drop the flash contents in the area beyond the firmware - *--reflash-full*[=_firmware_] rebuild the flash using the supplied firmware and drop the flash contents in the area beyond the firmware (default: select one interactively) (implies -r for safety reasons)
- *-r* *--reboot* reboot on startup instead of continuing from the saved state in the state file - *-r* *--reboot* reboot on startup instead of continuing from the saved state in the state file
# FILES # FILES

View file

@ -132,7 +132,7 @@ void config_init( char* progname, int argc, char* argv[] )
int print_config_and_exit = false; int print_config_and_exit = false;
const char* optstring = "hrc:D:df:Fn:t:"; const char* optstring = "hrf:n:s:S:";
struct option long_options[] = { struct option long_options[] = {
{"help", no_argument, NULL, 'h' }, {"help", no_argument, NULL, 'h' },
{"print-config", no_argument, &print_config_and_exit, true}, {"print-config", no_argument, &print_config_and_exit, true},
@ -140,20 +140,19 @@ void config_init( char* progname, int argc, char* argv[] )
{"datadir", required_argument, NULL, 1 }, {"datadir", required_argument, NULL, 1 },
{"enable-debug", required_argument, NULL, 'D' },
{"debug", no_argument, NULL, 'd' },
{"reflash", required_argument, NULL, 'f' },
{"reflash-full", no_argument, NULL, 'F' },
{"reboot", no_argument, NULL, 'r' },
{"50g", no_argument, NULL, 506 }, {"50g", no_argument, NULL, 506 },
{"49gp", no_argument, NULL, 496 }, {"49gp", no_argument, NULL, 496 },
{"newrpl-keyboard", no_argument, &clopt_newrpl, true}, {"newrpl-keyboard", no_argument, &clopt_newrpl, true},
{"name", required_argument, NULL, 'n' }, {"name", required_argument, NULL, 'n' },
{"font", required_argument, NULL, 'f' },
{"font-size", required_argument, NULL, 's' }, {"font-size", required_argument, NULL, 's' },
{"display-scale", required_argument, NULL, 'S' }, {"display-scale", required_argument, NULL, 'S' },
{"font", required_argument, NULL, 't' }, {"enable-debug", required_argument, NULL, 10 },
{"debug", no_argument, NULL, 11 },
{"reflash", required_argument, NULL, 90 },
{"reflash-full", required_argument, NULL, 91 },
{"reboot", no_argument, NULL, 'r' },
{0, 0, 0, 0 } {0, 0, 0, 0 }
}; };
@ -177,18 +176,18 @@ void config_init( char* progname, int argc, char* argv[] )
" --newrpl-keyboard label keyboard for newRPL\n" " --newrpl-keyboard label keyboard for newRPL\n"
"\n" "\n"
" -n --name[=<name>] set alternate UI name\n" " -n --name[=<name>] set alternate UI name\n"
" -t --font[=<fontname>] set alternate UI font\n" " -f --font[=<fontname>] set alternate UI font\n"
" -s --font-size[=<X>] scale text by X (default: 3)\n" " -s --font-size[=<X>] scale text by X (default: 3)\n"
" -S --display-scale[=<X>] scale LCD by X (default: 2)\n" " -S --display-scale[=<X>] scale LCD by X (default: 2)\n"
"\n" "\n"
" -D --enable-debug[=<port>] enable the debugger interface\n" " --enable-debug[=<port>] enable the debugger interface\n"
" (default port: %u)\n" " (default port: %u)\n"
" -d --debug use along -D to also start the debugger immediately\n" " --debug use along -D to also start the debugger immediately\n"
"\n" "\n"
" -f --reflash[=firmware] rebuild the flash using the supplied firmware\n" " --reflash[=firmware] rebuild the flash using the supplied firmware\n"
" (default: select one interactively)\n" " (default: select one interactively)\n"
" (implies -r for safety reasons)\n" " (implies -r for safety reasons)\n"
" -F --reflash-full use along -f to drop the flash contents\n" " --reflash-full[=firmware] rebuild the flash using the supplied firmware and drop the flash contents\n"
" in the area beyond the firmware\n" " in the area beyond the firmware\n"
" -r --reboot reboot on startup instead of continuing from the\n" " -r --reboot reboot on startup instead of continuing from the\n"
" saved state in the state file\n\n" " saved state in the state file\n\n"
@ -207,19 +206,21 @@ void config_init( char* progname, int argc, char* argv[] )
case 1: case 1:
opt.datadir = strdup( optarg ); opt.datadir = strdup( optarg );
break; break;
case 'D': case 10:
do_enable_debugger = true; do_enable_debugger = true;
opt.debug_port = atoi( optarg ); opt.debug_port = atoi( optarg );
break; break;
case 'd': case 11:
do_start_debugger = true; do_start_debugger = true;
break; break;
case 'f': case 90:
do_reflash = true; do_reflash = true;
opt.firmware = strdup( optarg ); opt.firmware = strdup( optarg );
break; break;
case 'F': case 91:
do_reflash = true;
do_reflash_full = true; do_reflash_full = true;
opt.firmware = strdup( optarg );
break; break;
case 496: case 496:
clopt_model = MODEL_49GP; clopt_model = MODEL_49GP;
@ -240,7 +241,7 @@ void config_init( char* progname, int argc, char* argv[] )
case 'S': case 'S':
clopt_display_scale = atoi( optarg ); clopt_display_scale = atoi( optarg );
break; break;
case 't': case 'f':
clopt_font = strdup( optarg ); clopt_font = strdup( optarg );
break; break;
default: default: