Skip to content

Commit a524b01

Browse files
authored
Add Claude Code CLI command completion (#1228)
1 parent 5d5c923 commit a524b01

2 files changed

Lines changed: 317 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Claude Code CLI completions
2+
3+
[Claude Code](https://docs.anthropic.com/en/docs/claude-code) is an agentic coding tool by Anthropic that lives in your terminal.
4+
5+
This completion script covers the `claude` command and its subcommands: `auth`, `mcp`, `plugin`, `agents`, `setup-token`, `doctor`, `update`, `upgrade`, and `install`.
6+
7+
## Install completion script
8+
9+
### Method 1: Use from Git repo
10+
11+
- `git clone https://github.com/nushell/nu_scripts.git`
12+
13+
- Add this to your `$nu.config-path` file:
14+
15+
```nu
16+
source path/to/nu_scripts/custom-completions/claude/claude-completions.nu
17+
```
18+
19+
### Method 2: Copy to completions directory
20+
21+
- Copy the _claude-completions.nu_ to the Nu standard completions directory:
22+
23+
```nu
24+
cp custom-completions/claude/claude-completions.nu ($nu.data-dir | path join 'completions')
25+
```
26+
27+
- Nushell will automatically load it on next startup.
Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
# Claude Code CLI completions for Nushell
2+
# Translated from bash completion script
3+
4+
def "nu-complete claude commands" [] {
5+
[agents auth mcp plugin setup-token doctor update upgrade install]
6+
}
7+
8+
def "nu-complete claude output-format" [] {
9+
[text json stream-json]
10+
}
11+
12+
def "nu-complete claude input-format" [] {
13+
[text stream-json]
14+
}
15+
16+
def "nu-complete claude permission-mode" [] {
17+
[acceptEdits bypassPermissions default dontAsk plan]
18+
}
19+
20+
def "nu-complete claude models" [] {
21+
[sonnet opus haiku claude-sonnet-4-6]
22+
}
23+
24+
def "nu-complete claude effort" [] {
25+
[low medium high]
26+
}
27+
28+
def "nu-complete claude scope" [] {
29+
[local user project]
30+
}
31+
32+
def "nu-complete claude scope-with-managed" [] {
33+
[local user project managed]
34+
}
35+
36+
def "nu-complete claude transport" [] {
37+
[stdio sse http]
38+
}
39+
40+
def "nu-complete claude install-channel" [] {
41+
[stable latest]
42+
}
43+
44+
# Main command
45+
export extern claude [
46+
--debug(-d) # Enable debug mode
47+
--debug-file: path # Debug output file
48+
--verbose # Verbose output
49+
--print(-p) # Print mode
50+
--output-format: string@"nu-complete claude output-format" # Output format
51+
--json-schema: string # JSON schema
52+
--include-partial-messages # Include partial messages
53+
--input-format: string@"nu-complete claude input-format" # Input format
54+
--mcp-debug # MCP debug mode
55+
--dangerously-skip-permissions # Skip permissions (dangerous)
56+
--allow-dangerously-skip-permissions # Allow skip permissions
57+
--max-budget-usd: number # Max budget in USD
58+
--replay-user-messages # Replay user messages
59+
--allowedTools: string # Allowed tools (deprecated)
60+
--allowed-tools: string # Allowed tools
61+
--tools: string # Tools
62+
--disallowedTools: string # Disallowed tools (deprecated)
63+
--disallowed-tools: string # Disallowed tools
64+
--mcp-config: path # MCP config file
65+
--system-prompt: string # System prompt
66+
--append-system-prompt: string # Append system prompt
67+
--permission-mode: string@"nu-complete claude permission-mode" # Permission mode
68+
--continue(-c) # Continue last session
69+
--resume(-r): string # Resume session by ID
70+
--fork-session # Fork session
71+
--no-session-persistence # Disable session persistence
72+
--model: string@"nu-complete claude models" # Model to use
73+
--agent: string # Agent name
74+
--betas: string # Beta features
75+
--fallback-model: string@"nu-complete claude models" # Fallback model
76+
--settings: path # Settings file
77+
--add-dir: path # Additional directory
78+
--ide: string # IDE integration
79+
--strict-mcp-config # Strict MCP config
80+
--session-id: string # Session ID
81+
--agents: string # Agents config
82+
--setting-sources: string@"nu-complete claude scope" # Setting sources
83+
--plugin-dir: path # Plugin directory
84+
--disable-slash-commands # Disable slash commands
85+
--chrome # Enable Chrome
86+
--no-chrome # Disable Chrome
87+
--from-pr: string # From PR
88+
--file: path # Input file
89+
--worktree(-w): string # Git worktree
90+
--tmux # Tmux mode
91+
--effort: string@"nu-complete claude effort" # Effort level
92+
--version(-v) # Show version
93+
--help(-h) # Show help
94+
...args: string # Command or prompt
95+
]
96+
97+
# --- auth ---
98+
99+
export extern "claude auth" [
100+
--help(-h)
101+
...args: string
102+
]
103+
104+
export extern "claude auth login" [
105+
--email: string # Login email
106+
--sso # Use SSO login
107+
--help(-h)
108+
]
109+
110+
export extern "claude auth logout" [
111+
--help(-h)
112+
]
113+
114+
def "nu-complete claude auth-status-format" [] {
115+
[json text]
116+
}
117+
118+
export extern "claude auth status" [
119+
--json # Output as JSON
120+
--text # Output as text
121+
--help(-h)
122+
]
123+
124+
# --- mcp ---
125+
126+
export extern "claude mcp" [
127+
--help(-h)
128+
...args: string
129+
]
130+
131+
export extern "claude mcp add" [
132+
--scope(-s): string@"nu-complete claude scope" # Scope
133+
--transport(-t): string@"nu-complete claude transport" # Transport type
134+
--env(-e): string # Environment variable
135+
--header(-H): string # Header
136+
--callback-port: int # Callback port
137+
--client-id: string # Client ID
138+
--client-secret # Client secret (interactive prompt)
139+
--help(-h)
140+
...args: string
141+
]
142+
143+
export extern "claude mcp add-from-claude-desktop" [
144+
--scope(-s): string@"nu-complete claude scope"
145+
--help(-h)
146+
...args: string
147+
]
148+
149+
export extern "claude mcp add-json" [
150+
--scope(-s): string@"nu-complete claude scope"
151+
--client-secret # Client secret (interactive prompt)
152+
--help(-h)
153+
...args: string
154+
]
155+
156+
export extern "claude mcp get" [
157+
--help(-h)
158+
...args: string
159+
]
160+
161+
export extern "claude mcp list" [
162+
--help(-h)
163+
]
164+
165+
export extern "claude mcp remove" [
166+
--scope(-s): string@"nu-complete claude scope"
167+
--help(-h)
168+
...args: string
169+
]
170+
171+
export extern "claude mcp reset-project-choices" [
172+
--help(-h)
173+
]
174+
175+
export extern "claude mcp serve" [
176+
--debug(-d)
177+
--verbose
178+
--help(-h)
179+
]
180+
181+
# --- plugin ---
182+
183+
export extern "claude plugin" [
184+
--help(-h)
185+
...args: string
186+
]
187+
188+
export extern "claude plugin disable" [
189+
--all(-a) # Disable all
190+
--scope(-s): string@"nu-complete claude scope"
191+
--help(-h)
192+
...args: string
193+
]
194+
195+
export extern "claude plugin enable" [
196+
--scope(-s): string@"nu-complete claude scope"
197+
--help(-h)
198+
...args: string
199+
]
200+
201+
export extern "claude plugin install" [
202+
--scope(-s): string@"nu-complete claude scope"
203+
--help(-h)
204+
...args: string
205+
]
206+
207+
export extern "claude plugin list" [
208+
--available
209+
--json
210+
--help(-h)
211+
]
212+
213+
export extern "claude plugin marketplace" [
214+
--help(-h)
215+
...args: string
216+
]
217+
218+
export extern "claude plugin marketplace add" [
219+
--help(-h)
220+
...args: string
221+
]
222+
223+
export extern "claude plugin marketplace list" [
224+
--json
225+
--help(-h)
226+
]
227+
228+
export extern "claude plugin marketplace remove" [
229+
--help(-h)
230+
...args: string
231+
]
232+
233+
export extern "claude plugin marketplace update" [
234+
--help(-h)
235+
...args: string
236+
]
237+
238+
export extern "claude plugin uninstall" [
239+
--scope(-s): string@"nu-complete claude scope"
240+
--help(-h)
241+
...args: string
242+
]
243+
244+
export extern "claude plugin update" [
245+
--scope(-s): string@"nu-complete claude scope-with-managed"
246+
--help(-h)
247+
...args: string
248+
]
249+
250+
export extern "claude plugin validate" [
251+
--help(-h)
252+
...args: string
253+
]
254+
255+
# --- agents ---
256+
257+
export extern "claude agents" [
258+
--setting-sources: string@"nu-complete claude scope"
259+
--help(-h)
260+
]
261+
262+
# --- setup-token ---
263+
264+
export extern "claude setup-token" [
265+
--help(-h)
266+
]
267+
268+
# --- doctor ---
269+
270+
export extern "claude doctor" [
271+
--help(-h)
272+
]
273+
274+
# --- update / upgrade ---
275+
276+
export extern "claude update" [
277+
--help(-h)
278+
]
279+
280+
export extern "claude upgrade" [
281+
--help(-h)
282+
]
283+
284+
# --- install ---
285+
286+
export extern "claude install" [
287+
--force
288+
--help(-h)
289+
channel?: string@"nu-complete claude install-channel" # Install channel
290+
]

0 commit comments

Comments
 (0)