feat(xce-test-cli-ux): add process-level help/version discovery
argp already provided --help/-?/--version with exit-without-REPL behavior, but had no -h alias (its default short help flag is -? per GNU argp convention) despite Requirement 4.1 naming -h explicitly. Added a hidden -h option triggering the same help path, and extended the doc string to describe the in-session help command. Proven against the real compiled binary via subprocess tests, not just argp's own in-process behavior. 1289/1289 controller suite passing (+4). Task 1.6 of .kiro/specs/xce-test-cli-ux/tasks.md. Requirements: 4.1, 4.2, 4.3 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019jaMf9QEwpugH2W9KAuc7f
This commit is contained in:
parent
204f81d134
commit
b70228c558
5 changed files with 270 additions and 2 deletions
|
|
@ -657,7 +657,15 @@ static command_ctx_t* active_ctx = &topctx;
|
|||
static char prompt[256];
|
||||
static int break_out = 0;
|
||||
|
||||
static char doc[] = "xce_test";
|
||||
/* xce-test-cli-ux task 1.6, Requirement 4.3: describes the in-session
|
||||
* `help' command as the way to list/learn available commands, in addition
|
||||
* to argp's own auto-generated --help/-?/-V flag documentation below. */
|
||||
static char doc[] =
|
||||
"xce_test -- interactive/scripted test client for the controller, "
|
||||
"worker, and scheduler\v"
|
||||
"Once a session is running, type `help' at the prompt to list the "
|
||||
"commands available in the current context, or `help <command>' for "
|
||||
"details on a specific one.";
|
||||
static char args_doc[] = "";
|
||||
|
||||
/* build-time-versioning task 3.2: no longer a compile-time initializer --
|
||||
|
|
@ -681,6 +689,13 @@ struct arguments {
|
|||
static struct argp_option options[] = {
|
||||
{ "verbose", 'v', 0, 0, "Produce verbose logs" },
|
||||
{ "norc", OPT_NORC, 0, 0, "Skip loading the rc file for this invocation" },
|
||||
/* xce-test-cli-ux task 1.6, Requirement 4.1: argp's OWN built-in help
|
||||
* alias is `-?` (via --help), NOT `-h` -- glibc argp does not add `-h`
|
||||
* automatically. `-h` is hidden from the rendered help/usage text
|
||||
* (OPTION_HIDDEN) so it doesn't duplicate the auto-generated
|
||||
* "-?, --help" entry there; it is still a fully functional alias,
|
||||
* handled explicitly in parse_opt() below via argp_state_help(). */
|
||||
{ 0, 'h', 0, OPTION_HIDDEN, 0 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
|
@ -695,6 +710,12 @@ static error_t parse_opt(int key, char* arg, struct argp_state* state)
|
|||
case OPT_NORC:
|
||||
arguments->norc = 1;
|
||||
break;
|
||||
case 'h':
|
||||
/* ARGP_HELP_STD_HELP includes ARGP_HELP_EXIT_OK, so this prints
|
||||
* the same help text as --help/-? and exits(0) -- it does not
|
||||
* return. */
|
||||
argp_state_help(state, stdout, ARGP_HELP_STD_HELP);
|
||||
break;
|
||||
default:
|
||||
return ARGP_ERR_UNKNOWN;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue