Source File
snippet.go
Belonging Package
github.com/rsteube/carapace/internal/shell/bash
// Package bash provides bash completionpackage bashimport ()// Snippet creates the bash completion script.func ( *cobra.Command) string {:= fmt.Sprintf(`#!/bin/bash_%v_completion() {export COMP_WORDBREAKSexport COMP_LINEexport COMP_POINTlocal nospace data compline="${COMP_LINE:0:${COMP_POINT}}"if echo ${compline}"''" | xargs echo 2>/dev/null > /dev/null; thendata=$(echo ${compline}"''" | xargs %v _carapace bash)elif echo ${compline} | sed "s/\$/'/" | xargs echo 2>/dev/null > /dev/null; thendata=$(echo ${compline} | sed "s/\$/'/" | xargs %v _carapace bash)elsedata=$(echo ${compline} | sed 's/$/"/' | xargs %v _carapace bash)fiIFS=$'\001' read -r -d '' nospace data <<<"${data}"mapfile -t COMPREPLY < <(echo "${data}")unset COMPREPLY[-1][ "${nospace}" = true ] && compopt -o nospacelocal IFS=$'\n'[[ "${COMPREPLY[*]}" == "" ]] && COMPREPLY=() # fix for mapfile creating a non-empty array from empty command output}complete -o noquote -F _%v_completion %v`, .Name(), uid.Executable(), uid.Executable(), uid.Executable(), .Name(), .Name())return}
![]() |
The pages are generated with Golds v0.8.2. (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. |