diff --git a/docs/src/carapace-spec/macros/modifier.md b/docs/src/carapace-spec/macros/modifier.md index 0d891a1..dde6ce0 100644 --- a/docs/src/carapace-spec/macros/modifier.md +++ b/docs/src/carapace-spec/macros/modifier.md @@ -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 `["", "", ""]` specific `[" ||| ||| "]`. + +> The delimiter (` ||| `) is currently very strict and not trimmed. ## chdir -[`$chdir()`](https://rsteube.github.io/carapace/carapace/action/chDir.html) changes the directory. +[`$chdir()`](https://rsteube.github.io/carapace/carapace/action/chdir.html) changes the directory. + +```yaml +["$files", "$chdir(/tmp)"] +``` + +## filter + +[`$filter([])`](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()`](https://rsteube.github.io/carapace/carapace/action/actionMultiParts.html) completes values as list with given delimiter. +[`$list()`](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()`](https://rsteube.github.io/carapace/carapace/invokedAction/toMultiPartsA.html) completes values splitted on given delimiters separately. +[`$multiparts([])`](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()`](https://rsteube.github.io/carapace/carapace/action/noSpace.html) disables space suffix for given character(s). + +```yaml +["one", "two/", "three,", "$nospace(/,)"] +``` + +## prefix + +[`$pefix()`](https://rsteube.github.io/carapace/carapace/action/prefix.html) adds a prefix to the inserted values. + +```yaml +["$files", "$prefix(file://)"] +``` + +## retain + +[`$retain([])`](https://rsteube.github.io/carapace/carapace/action/retain.html) retains given values. + +```yaml +["one", "two", "three", "$retain([two])"] +``` + +## shift + +[`$shift()`](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()`](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()`](https://rsteube.github.io/carapace/carapace/action/suppress.html) suppresses specific error messages using a regular expression. +```yaml +["$message(fail)", "$suppress(fail)"] +``` + +## style + +[`$style(