package oilimport (shlex)// Snippet creates the oil completion script.func ( *cobra.Command) string {returnSnippetSingle(.Name(), false)}// SnippetMulti creates a multi-completer oil completion script.func ( []string, string, string) string { := make([]string, 0, len())for , := range { = append(, shlex.Quote(, shlex.Bash)) }returnfmt.Sprintf(`#!/bin/osh%[4]v_%[1]v_completer() { local command="${COMP_WORDS[0]}" local compline="${COMP_LINE:0:${COMP_POINT}}" local IFS=$'\n' mapfile -t COMPREPLY < <(echo "$compline" | sed -e "s/ \$/ ''/" -e 's/"/\"/g' | xargs %[2]v "${command}" _carapace oil) [[ "${COMPREPLY[@]}" == "" ]] && COMPREPLY=() # fix for mapfile creating a non-empty array from empty command output [[ ${COMPREPLY[0]} == *[/=@:.,$'\001'] ]] && compopt -o nospace # shellcheck disable=SC2206 [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=(${COMPREPLY[@]%%$'\001'})}complete -F _%[1]v_completer %[3]v`, , shlex.Quote(uid.Executable(), shlex.Bash), strings.Join(, " "), )}// SnippetSingle creates a single-command oil completion script.// When explicitCommand is true, the command name is included in the invocation// (for multi-completer subcommands). When false, the executable is invoked// without an explicit command (standalone mode).func ( string, bool) string { := fmt.Sprintf("%v _carapace oil", shlex.Quote(uid.Executable(), shlex.Bash))if { = fmt.Sprintf("%v %v _carapace oil", shlex.Quote(uid.Executable(), shlex.Bash), shlex.Quote(, shlex.Bash)) }returnfmt.Sprintf(`#!/bin/osh_%v_completion() { local compline="${COMP_LINE:0:${COMP_POINT}}" local IFS=$'\n' mapfile -t COMPREPLY < <(echo "$compline" | sed -e "s/ \$/ ''/" -e 's/"/\"/g' | xargs %v) [[ "${COMPREPLY[@]}" == "" ]] && COMPREPLY=() # fix for mapfile creating a non-empty array from empty command output [[ ${COMPREPLY[0]} == *[/=@:.,$'\001'] ]] && compopt -o nospace # TODO use mapfile # shellcheck disable=SC2206 [[ ${#COMPREPLY[@]} -eq 1 ]] && COMPREPLY=(${COMPREPLY[@]%%$'\001'})}complete -F _%v_completion %v`, , , shlex.Quote(, shlex.Bash), )}
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.