-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2279 from rsteube/doc-moved-example
doc: moved journalctl example
- Loading branch information
Showing
3 changed files
with
6 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |