Repository navigation
Commit f4d6874
Fix claude completion for optional-valued flags (#1288)
`--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](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 44f8f25 commit f4d6874
1 file changed
Lines changed: 13 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| |||
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
69 | | - | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| |||
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
87 | | - | |
| 93 | + | |
88 | 94 | | |
89 | | - | |
| 95 | + | |
| 96 | + | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
| |||
0 commit comments