-
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #208 from rsteube/doc-modifier
doc: updated modifier
- Loading branch information
Showing
1 changed file
with
110 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,141 @@ | ||
# Modifier | ||
|
||
Modifiers change the completion for a position in general. | ||
Modifiers change the completion of macros and values. | ||
These can be set generic `["<macro>", "<value>", "<modifier>"]` specific `["<macro> ||| <modifier> ||| <modifier>"]`. | ||
|
||
> The delimiter (` ||| `) is currently very strict and not trimmed. | ||
## chdir | ||
|
||
[`$chdir(<directory>)`](https://rsteube.github.io/carapace/carapace/action/chDir.html) changes the directory. | ||
[`$chdir(<directory>)`](https://rsteube.github.io/carapace/carapace/action/chdir.html) changes the directory. | ||
|
||
```yaml | ||
["$files", "$chdir(/tmp)"] | ||
``` | ||
|
||
## filter | ||
|
||
[`$filter([<value>])`](https://rsteube.github.io/carapace/carapace/action/filter.html) filters given values. | ||
|
||
```yml | ||
["$chdir(/tmp)", "$(pwd)"] | ||
```yaml | ||
["one", "two", "three", "$filter([two])"] | ||
``` | ||
|
||
## filterargs | ||
|
||
[`$filterargs`](https://rsteube.github.io/carapace/carapace/action/filterArgs.html) filters `Context.Args`. | ||
|
||
```yaml | ||
["$files", "$filterargs"] | ||
``` | ||
|
||
## list | ||
|
||
[`$list(<delimiter>)`](https://rsteube.github.io/carapace/carapace/action/actionMultiParts.html) completes values as list with given delimiter. | ||
[`$list(<delimiter>)`](https://rsteube.github.io/carapace/carapace/action/list.html) creates a list with given divider. | ||
|
||
```yml | ||
["$list(,)", "a", "b", "c", "d"] | ||
```yaml | ||
["one", "two", "three", "$list(,)"] | ||
``` | ||
|
||
## multiparts | ||
|
||
[`$multiparts(<delimiter>)`](https://rsteube.github.io/carapace/carapace/invokedAction/toMultiPartsA.html) completes values splitted on given delimiters separately. | ||
[`$multiparts([<delimiter>])`](https://rsteube.github.io/carapace/carapace/action/multiParts.html) completes values splitted by given delimiter(s) separately. | ||
|
||
```yml | ||
["$multiparts([/])", "a", "a/b", "a/c", "b", "b/a"] | ||
```yaml | ||
["one/two/three", "$multiparts([/])"] | ||
``` | ||
|
||
## nospace | ||
|
||
`$nospace` prevents space suffix being added to the inserted values. | ||
[`$nospace(<characters>)`](https://rsteube.github.io/carapace/carapace/action/noSpace.html) disables space suffix for given character(s). | ||
|
||
```yaml | ||
["one", "two/", "three,", "$nospace(/,)"] | ||
``` | ||
|
||
## prefix | ||
|
||
[`$pefix(<prefix>)`](https://rsteube.github.io/carapace/carapace/action/prefix.html) adds a prefix to the inserted values. | ||
|
||
```yaml | ||
["$files", "$prefix(file://)"] | ||
``` | ||
|
||
## retain | ||
|
||
[`$retain([<value>])`](https://rsteube.github.io/carapace/carapace/action/retain.html) retains given values. | ||
|
||
```yaml | ||
["one", "two", "three", "$retain([two])"] | ||
``` | ||
|
||
## shift | ||
|
||
[`$shift(<n>)`](https://rsteube.github.io/carapace/carapace/action/shift.html) shifts positional arguments left n times. | ||
|
||
```yaml | ||
["one", "two", "three", "$filterargs", "$shift(1)"] | ||
``` | ||
|
||
## split | ||
|
||
[`$split`](https://rsteube.github.io/carapace/carapace/action/split.html) splits `Context.Value` lexicographically and replaces `Context.Args` with the tokens. | ||
|
||
```yaml | ||
["one", "two", "three", "$filterargs", "$split"] | ||
``` | ||
|
||
## splitp | ||
|
||
[`$splitp`](https://rsteube.github.io/carapace/carapace/action/splitP.html) is like Split but supports pipelines. | ||
|
||
```yaml | ||
["one", "two", "three", "$filterargs", "$splitp"] | ||
``` | ||
|
||
## suffix | ||
|
||
[`$suffix(<suffix>)`](https://rsteube.github.io/carapace/carapace/action/suffix.html) adds a suffix to the inserted values. | ||
|
||
```yml | ||
["$nospace", "one", "two"] | ||
```yaml | ||
["apple", "melon", "orange", "$suffix(juice)"] | ||
``` | ||
|
||
## noflag | ||
## suppress | ||
|
||
`$noflag` disables flag parsing for the corresponding (sub)command. | ||
[`$suppress(<regex>)`](https://rsteube.github.io/carapace/carapace/action/suppress.html) suppresses specific error messages using a regular expression. | ||
```yaml | ||
["$message(fail)", "$suppress(fail)"] | ||
``` | ||
|
||
## style | ||
|
||
[`$style(<style>)`](https://rsteube.github.io/carapace/carapace/action/style.html) sets the style for all values. | ||
|
||
```yml | ||
["$noflag"] | ||
```yaml | ||
["one", "two", "three", "$style(underlined)"] | ||
``` | ||
|
||
## tag | ||
|
||
[`$tag(<tag>)`](https://rsteube.github.io/carapace/carapace/action/tag.html) sets the tag for all values. | ||
|
||
```yaml | ||
["one", "two", "three", "$tag(numbers)"] | ||
``` | ||
|
||
## uniquelist | ||
|
||
[`$uniquelist(<delimiter>)`](https://rsteube.github.io/carapace/carapace/action/actionMultiParts.html) completes values as unique list with given delimiter. | ||
[`$uniquelist(<delimiter>)`](https://rsteube.github.io/carapace/carapace/action/uniqueList.html) creates a unique list with given divider. | ||
|
||
```yaml | ||
["one", "two", "three", "$uniquelist(,)"] | ||
``` | ||
|
||
## usage | ||
|
||
[`$usage(<usage>)`](https://rsteube.github.io/carapace/carapace/action/usage.html) sets the usage message. | ||
|
||
```yml | ||
["$uniquelist(,)", "a", "b", "c", "d"] | ||
```yaml | ||
["$usage(custom)"] | ||
``` |