fix(cli): fix --no-tty flag not being recognized in init command#783
Merged
pyramation merged 1 commit intomainfrom Mar 6, 2026
Merged
fix(cli): fix --no-tty flag not being recognized in init command#783pyramation merged 1 commit intomainfrom
pyramation merged 1 commit intomainfrom
Conversation
## Problem
The `--no-tty` flag was not working when running `pgpm init` commands.
Users expecting non-interactive mode with `--no-tty` would still get
interactive prompts.
## Root Cause
minimist parses `--no-<name>` flags differently than expected:
- `--no-tty` is parsed as `{ tty: false }`, NOT `{ 'no-tty': true }`
The original code checked for `argv['no-tty']`, which would always be
`undefined`, causing the flag to be silently ignored.
## Solution
Added `argv.tty === false` check to correctly detect the `--no-tty` flag:
```typescript
// Before (bug)
const noTty = Boolean(argv.noTty || argv['no-tty'] || process.env.CI);
// After (fixed)
const noTty = Boolean(argv.noTty || argv['no-tty'] || argv.tty === false || process.env.CI);
```
## Files Changed
- pgpm/cli/src/commands/init/index.ts (2 occurrences)
- pgpm/cli/src/commands/init/workspace.ts (1 occurrence)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
--no-ttyflag was not working when runningpgpm initcommands. Users expecting non-interactive mode with--no-ttywould still get interactive prompts.Root Cause
minimist parses
--no-<name>flags differently than expected:--no-ttyis parsed as{ tty: false }, NOT{ 'no-tty': true }The original code checked for
argv['no-tty'], which would always beundefined, causing the flag to be silently ignored.Solution
Added
argv.tty === falsecheck to correctly detect the--no-ttyflag:Files Changed