// Package oil provides Oil completion
package oil import ( ) // Snippet creates the oil completion script. func ( *cobra.Command) string { := fmt.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 _carapace oil) [[ "${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 `, .Name(), uid.Executable(), .Name(), .Name()) return }