Skip to content

Commit 46ef736

Browse files
Remove completion while I figure out a strategy (#213)
1 parent 3a5faa2 commit 46ef736

25 files changed

Lines changed: 9 additions & 949 deletions

README.md

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Tiny, simple, but powerful CLI framework for modern Go 🚀
2525
- [Sub Commands](#sub-commands)
2626
- [Flags](#flags)
2727
- [Arguments](#arguments)
28-
- [Shell Completion](#shell-completion)
2928
- [Core Principles](#core-principles)
3029
- [😱 Well behaved libraries don't panic](#-well-behaved-libraries-dont-panic)
3130
- [🧘🏻 Keep it Simple](#-keep-it-simple)
@@ -331,33 +330,6 @@ The types you can currently use for positional args are:
331330
> 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
332331
> 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
333332
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]:
351-
352-
```shell
353-
mytool completion > ~/.config/carapace/specs/mytool.yaml
354-
```
355-
356-
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-
361333
## Core Principles
362334

363335
When designing and implementing `cli`, I had some core goals and guiding principles for implementation.
@@ -455,6 +427,14 @@ var delete bool
455427
cli.New("demo", cli.Flag(&delete, "delete", cli.NoShortHand, "Delete something"))
456428
```
457429

430+
## Gaps
431+
432+
`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+
458438
## In the Wild
459439

460440
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
468448
[spf13/pflag]: https://github.com/spf13/pflag
469449
[urfave/cli]: https://github.com/urfave/cli
470450
[functional options]: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
471-
[carapace-bin]: https://github.com/carapace-sh/carapace-bin
472-
[carapace-spec]: https://github.com/carapace-sh/carapace-spec

completion.go

Lines changed: 0 additions & 182 deletions
This file was deleted.

0 commit comments

Comments
 (0)