Skip to content

Fix claude completion for optional-valued flags - #1288

Merged
fdncred merged 1 commit into
nushell:mainfrom
0x4D5352:claude-optional-value-flags
Oct 18, 2026
Merged

fdncred merged 1 commit into
nushell:mainfrom
0x4D5352:claude-optional-value-flags

Conversation

@0x4D5352

@0x4D5352 0x4D5352 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

--resume, --from-pr and --worktree take an optional value in the Claude Code CLI (-r, --resume [value] in claude --help), but the extern declared them as string flags. A bare claude --resume, which is how you open the interactive session picker, therefore fails to parse:

Error: nu::parser::missing_flag_param
  x Missing flag argument.

Nushell flags can't have an optional value, so this declares the three as switches. An extern passes its arguments to the external command in the order they were typed, so a value after the switch still arrives where the CLI expects it:

claude --resume              => [--resume]
claude -r abc -p hi          => [--resume][abc][--print][hi]
claude -w feature            => [--worktree][feature]
claude --from-pr 123         => [--from-pr][123]
claude --remote-control desk => [--remote-control][desk]

(argv as received by a stub claude on PATH.) The one thing lost is the --resume=<id> spelling, which Nushell reads as a boolean on a switch; --resume <id> works.

Also:

  • adds --remote-control, which was missing and takes an optional name in the same way
  • refreshes the value lists against Claude Code 2.1.302: effort gains xhigh and max; permission-mode gains auto and manual and drops default, which the CLI no longer lists as a choice; models moves to the current aliases (fable, opus, sonnet, haiku) and model IDs

Tested on Nushell 0.116.1: toolkit.nu check pr on the file passes, and commandline complete returns the new lists for --effort, --permission-mode and --model.

🤖 Generated with Claude Code

`--resume`, `--from-pr` and `--worktree` take an optional value in the
Claude Code CLI but were declared as `string` flags, so a bare
`claude --resume`, the documented way to open the session picker, failed
with `nu::parser::missing_flag_param`. Declare them as switches: an
extern passes its arguments through in the order they were typed, so
`claude --resume <id>` still reaches the CLI as `--resume <id>`. Add the
missing `--remote-control`, which takes an optional name in the same way.

Refresh the value lists against Claude Code 2.1.302: effort gains `xhigh`
and `max`, permission-mode gains `auto` and `manual` and loses `default`,
and the model list moves to the current aliases and model IDs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0x4D5352
0x4D5352 force-pushed the claude-optional-value-flags branch from f7a59d1 to 236d9b0 Compare October 18, 2026 22:06
@fdncred
fdncred merged commit f4d6874 into nushell:main Oct 18, 2026
1 check passed
@fdncred

fdncred commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants