feat(xce-test-rc-file): task 2.1 add --norc flag to xce_test
Adds struct arguments.norc, a --norc argp option, OPT_NORC (matching main.c's OPT_PEERS/OPT_CONF_KEEP_N idiom), and its parse_opt case to test.c. Parsing/recording only -- no wiring into main()'s control flow or rcfile.c yet (task 2.2). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AgYRU3zDTqNGV5Jk8aiKLg
This commit is contained in:
parent
77aba21fb0
commit
68fcd657d6
2 changed files with 10 additions and 1 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
- _Requirements: 1.2, 1.3_
|
- _Requirements: 1.2, 1.3_
|
||||||
|
|
||||||
- [ ] 2. Core: xce_test startup integration
|
- [ ] 2. Core: xce_test startup integration
|
||||||
- [ ] 2.1 Add a flag that skips rc-file loading for a single invocation
|
- [x] 2.1 Add a flag that skips rc-file loading for a single invocation
|
||||||
- Register the flag with xce_test's existing command-line option parsing so it is documented in xce_test's own help output
|
- Register the flag with xce_test's existing command-line option parsing so it is documented in xce_test's own help output
|
||||||
- When the flag is given, record that rc-file loading should be skipped for this run
|
- When the flag is given, record that rc-file loading should be skipped for this run
|
||||||
- Observable: xce_test's help output lists the new flag with a description, and invoking xce_test with the flag parses successfully and records the skip state (verified directly, independent of task 2.2's wiring)
|
- Observable: xce_test's help output lists the new flag with a description, and invoking xce_test with the flag parses successfully and records the skip state (verified directly, independent of task 2.2's wiring)
|
||||||
|
|
|
||||||
|
|
@ -667,12 +667,18 @@ static char args_doc[] = "";
|
||||||
const char* argp_program_version = NULL;
|
const char* argp_program_version = NULL;
|
||||||
const char* argp_program_bug_address = BUG_EMAIL;
|
const char* argp_program_bug_address = BUG_EMAIL;
|
||||||
|
|
||||||
|
/* Long-option key (above ASCII to avoid collisions with short opts) --
|
||||||
|
* mirrors src/controller/main.c's OPT_PEERS/OPT_CONF_KEEP_N idiom. */
|
||||||
|
#define OPT_NORC 256
|
||||||
|
|
||||||
struct arguments {
|
struct arguments {
|
||||||
int verbose;
|
int verbose;
|
||||||
|
int norc;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
{ "verbose", 'v', 0, 0, "Produce verbose logs" },
|
{ "verbose", 'v', 0, 0, "Produce verbose logs" },
|
||||||
|
{ "norc", OPT_NORC, 0, 0, "Skip loading the rc file for this invocation" },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -684,6 +690,9 @@ static error_t parse_opt(int key, char* arg, struct argp_state* state)
|
||||||
case 'v':
|
case 'v':
|
||||||
arguments->verbose++;
|
arguments->verbose++;
|
||||||
break;
|
break;
|
||||||
|
case OPT_NORC:
|
||||||
|
arguments->norc = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return ARGP_ERR_UNKNOWN;
|
return ARGP_ERR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue