You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-30Lines changed: 8 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,6 @@ Tiny, simple, but powerful CLI framework for modern Go 🚀
25
25
-[Sub Commands](#sub-commands)
26
26
-[Flags](#flags)
27
27
-[Arguments](#arguments)
28
-
-[Shell Completion](#shell-completion)
29
28
-[Core Principles](#core-principles)
30
29
-[😱 Well behaved libraries don't panic](#-well-behaved-libraries-dont-panic)
31
30
-[🧘🏻 Keep it Simple](#-keep-it-simple)
@@ -331,33 +330,6 @@ The types you can currently use for positional args are:
331
330
> Slice types are not supported (yet), for those you need to use the `cmd.Args()` method to get the arguments manually. I plan to address this but it can be tricky
332
331
> as slice types will eat up the remainder of the arguments so I need to figure out a good DevEx for this as it could lead to confusing outcomes
333
332
334
-
### Shell Completion
335
-
336
-
`cli` has built-in support for shell completions via [carapace-bin]. Wire in `cli.CompletionSubCommand()` alongside your other subcommands:
337
-
338
-
```go
339
-
cmd, err:= cli.New(
340
-
"mytool",
341
-
// ...
342
-
cli.SubCommands(
343
-
buildServeCommand,
344
-
buildDeployCommand,
345
-
cli.CompletionSubCommand(), // add this
346
-
),
347
-
)
348
-
```
349
-
350
-
Running `mytool completion` outputs a [carapace-spec] YAML document describing your full command tree — all subcommands, flags, and descriptions. Redirect it once to register completions with [carapace-bin]:
carapace-bin then provides completions across bash, zsh, fish, nushell, PowerShell, and more — no shell-specific scripts required.
357
-
358
-
> [!TIP]
359
-
> See the [`./examples/completion`](https://github.com/FollowTheProcess/cli/tree/main/examples/completion) example for a working demonstration, and the [carapace-spec] docs for how to extend the generated YAML with semantic completion hints (file paths, environment variables, etc.)
360
-
361
333
## Core Principles
362
334
363
335
When designing and implementing `cli`, I had some core goals and guiding principles for implementation.
`cli` is new and under active development, so naturally there are some gaps compared to more mature frameworks:
433
+
434
+
- No shell completion (yet): I'm thinking about some smart ways to achieve this and haven't made up my mind yet
435
+
- Man page generation: Similar to shell completion
436
+
- Text wrapping and terminal width detection for `--help` (currently this is on you to format when writing)
437
+
458
438
## In the Wild
459
439
460
440
I built `cli` for my own uses really, so I've quickly adopted it across a number of tools. See the following projects for some working examples in real code:
@@ -468,5 +448,3 @@ I built `cli` for my own uses really, so I've quickly adopted it across a number
0 commit comments