Skip to content

Commit

Permalink
fix: allow undefined from flag parser
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Sep 22, 2023
1 parent 090f675 commit 878da23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/cli-ux/styled/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ export namespace table {
columns: Interfaces.OptionFlag<string | undefined>;
sort: Interfaces.OptionFlag<string | undefined>;
filter: Interfaces.OptionFlag<string | undefined>;
csv: Interfaces.Flag<boolean>;
csv: Interfaces.BooleanFlag<boolean>;
output: Interfaces.OptionFlag<string | undefined>;
extended: Interfaces.Flag<boolean>;
'no-truncate': Interfaces.Flag<boolean>;
'no-header': Interfaces.Flag<boolean>;
extended: Interfaces.BooleanFlag<boolean>;
'no-truncate': Interfaces.BooleanFlag<boolean>;
'no-header': Interfaces.BooleanFlag<boolean>;
} = {
columns: F.string({exclusive: ['extended'], description: 'only show provided columns (comma-separated)'}),
sort: F.string({description: 'property to sort by (prepend \'-\' for descending)'}),
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export type OptionFlagProps = FlagProps & {
export type FlagParserContext = Command & {token: FlagToken}

export type FlagParser<T, I extends string | boolean, P = CustomOptions> = (input: I, context: FlagParserContext, opts: P & OptionFlag<T, P>) =>
T extends Array<infer U> ? Promise<U> : Promise<T>
T extends Array<infer U> ? Promise<U | undefined> : Promise<T | undefined>

export type ArgParserContext = Command & {token: ArgToken}

Expand Down

0 comments on commit 878da23

Please sign in to comment.