Skip to content

Commit

Permalink
Merge pull request #2279 from rsteube/doc-moved-example
Browse files Browse the repository at this point in the history
doc: moved journalctl example
  • Loading branch information
rsteube authored Feb 29, 2024
2 parents beab5ec + e2f02d2 commit 6d25008
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- [Manually](./development/creatingCompleters/manually.md)
- [Parsing](./development/creatingCompleters/parsing.md)
- [Scraping](./development/creatingCompleters/scraping.md)
- [Examples](./development/creatingCompleters/examples.md)
- [Updating Completers](./development/updatingCompleters.md)
- [Best Practices](./development/bestPractices.md)
- [Coupled Actions](./development/bestPractices/coupledActions.md)
Expand Down
32 changes: 0 additions & 32 deletions docs/src/development/creatingCompleters.md
Original file line number Diff line number Diff line change
@@ -1,33 +1 @@
# Creating completers


- copy a basic completer for simplicity
```sh
cp -r completers/cp_completer completers/ln_completer
```
- update the package name in `main.go`
- replace `root.go`
```sh
ln --help | carapace-parse -n ln > completers/ln_completer/cmd/root.go
```
- fix issues and add completions as required
```go
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"backup": carapace.ActionValues("existing", "nil", "none", "off", "numbered", "t", "simple", "never"),
"target-directory": carapace.ActionDirectories(),
})

carapace.Gen(rootCmd).PositionalAnyCompletion(
carapace.ActionFiles(""),
)
```
- run the generator once to add the new completer
```sh
# cmd/carapace
go generate ./...
go install
```

## Example

[![asciicast](https://asciinema.org/a/466859.svg)](https://asciinema.org/a/466859)
5 changes: 5 additions & 0 deletions docs/src/development/creatingCompleters/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Examples

## Journalctl

[![asciicast](https://asciinema.org/a/466859.svg)](https://asciinema.org/a/466859)

0 comments on commit 6d25008

Please sign in to comment.