Skip to content

Commit

Permalink
fix(cli): get default option
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed May 7, 2024
1 parent 696998b commit 1c05dec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/friendly-falcons-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@datatruck/cli": patch
---

Fix `prune` command
4 changes: 3 additions & 1 deletion packages/cli/src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ export function createCommand<T extends OptionsConfig>(
const option = config.options[name];
if (option.flag !== false) {
const parse =
typeof option.value === "string" ? parsers[option.value] : undefined;
typeof option.value === "string"
? parsers[option.value]
: option.value;
const cliValue = cliOptions[option.flag ?? name] ?? option.defaults;
if (cliValue !== undefined)
commandOptions[name] = parse ? parse(cliValue) : cliValue;
Expand Down

0 comments on commit 1c05dec

Please sign in to comment.