-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use command value instead of getters for dryRun and interactive
- Loading branch information
1 parent
9bc03fe
commit 5d75b2a
Showing
7 changed files
with
44 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 27 additions & 18 deletions
45
packages/cli/src/lib/commands/collect/utils/persist/open-report.unit.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
import { argv, Options } from 'yargs'; | ||
import { getEnvPreset } from '../../pre-set'; | ||
|
||
function getDefaultByCliMode(): boolean { | ||
return getEnvPreset().interactive as boolean; | ||
} | ||
export const interactive = { | ||
alias: 'i', | ||
type: 'boolean', | ||
description: 'When false questions are skipped with the values from the suggestions. This is useful for CI integrations.', | ||
default: getDefaultByCliMode() | ||
default: getEnvPreset().interactive, | ||
} satisfies Options; | ||
|
||
const defaultValue = interactive.default; | ||
|
||
// We don't rely on yargs option normalization features as this can happen before cli bootstrap | ||
export function get(): boolean { | ||
const { interactive, i } = argv as any as {interactive?: boolean, i?: boolean}; | ||
return interactive !== undefined ? Boolean(interactive) : i !== undefined ? Boolean(i) : defaultValue; | ||
const { interactive } = argv as any as { interactive: boolean }; | ||
return interactive; | ||
} |