You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
Use-case:
We have certain instances where we want to type check and parse flag values differently depending on if a default config.json value is being consumed vs explicitly flagged within the CLI command directly. ie
CLI: COMMAND --markers foo,buzz
CONFIG.json: "markers": ["foo", "buzz"]
parse: m => {
// return do something with m under both scenarios
}
Is it possible to "force" parse to execute within the context of flags.build when a default value is set. Appears currently if a default flag value is set parse is never executed.
flags.build#parse will execute
export const foo = flags.build({
description: `foo foo`,
parse: f => {
if (typeof f === 'string') {
// do something
}
}
});
flags.build#parse will NOT execute
export const foo = flags.build({
default: 'foo',
description: `foo foo`,
parse: f => {
if (typeof f === 'string') {
// do something
}
}
});
The text was updated successfully, but these errors were encountered:
Is it possible to "force" parse to execute ... when a default value is set.
No.
Appears currently if a default flag value is set parse is never executed.
Yes, that's correct.
We have certain instances where we want to type check and parse flag values differently depending on if a default config.json value is being consumed vs explicitly flagged within the CLI command directly.
How you're parsing the markers flag is the right way to do it:
(Please direct this question to a different repo if warranted).
Current implementation:
https://github.com/TracerBench/tracerbench/blob/c9b4a5457cfcd21af93dc96f7cd1221eedf6b269/packages/cli/src/helpers/flags.ts#L7-L13
Use-case:
We have certain instances where we want to type check and parse flag values differently depending on if a default config.json value is being consumed vs explicitly flagged within the CLI command directly. ie
CLI:
COMMAND --markers foo,buzz
CONFIG.json:
"markers": ["foo", "buzz"]
parse: m => {
// return do something with m under both scenarios
}
Is it possible to "force"
parse
to execute within the context offlags.build
when a default value is set. Appears currently if a default flag value is setparse
is never executed.flags.build#parse
will executeflags.build#parse
will NOT executeThe text was updated successfully, but these errors were encountered: