mirror of
https://github.com/spf13/cobra
synced 2025-05-06 13:27:26 +00:00
Add Linkerd to list of projects using Cobra
This commit is contained in:
parent
f2b07da1e2
commit
64872dd43f
2 changed files with 11 additions and 4 deletions
|
@ -24,6 +24,7 @@ Many of the most widely used Go projects are built using Cobra, such as:
|
||||||
[Prototool](https://github.com/uber/prototool),
|
[Prototool](https://github.com/uber/prototool),
|
||||||
[mattermost-server](https://github.com/mattermost/mattermost-server),
|
[mattermost-server](https://github.com/mattermost/mattermost-server),
|
||||||
[Gardener](https://github.com/gardener/gardenctl),
|
[Gardener](https://github.com/gardener/gardenctl),
|
||||||
|
[Linkerd](https://linkerd.io/),
|
||||||
etc.
|
etc.
|
||||||
|
|
||||||
[](https://travis-ci.org/spf13/cobra)
|
[](https://travis-ci.org/spf13/cobra)
|
||||||
|
|
|
@ -72,7 +72,9 @@ __%[1]s_handle_reply()
|
||||||
else
|
else
|
||||||
allflags=("${flags[*]} ${two_word_flags[*]}")
|
allflags=("${flags[*]} ${two_word_flags[*]}")
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
|
while IFS='' read -r c; do
|
||||||
|
COMPREPLY+=("$c")
|
||||||
|
done < <(compgen -W "${allflags[*]}" -- "$cur")
|
||||||
if [[ $(type -t compopt) = "builtin" ]]; then
|
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||||
[[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
|
[[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
|
||||||
fi
|
fi
|
||||||
|
@ -122,10 +124,14 @@ __%[1]s_handle_reply()
|
||||||
if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
|
if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
|
||||||
completions+=("${must_have_one_flag[@]}")
|
completions+=("${must_have_one_flag[@]}")
|
||||||
fi
|
fi
|
||||||
COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
|
while IFS='' read -r c; do
|
||||||
|
COMPREPLY+=("$c")
|
||||||
|
done < <(compgen -W "${completions[*]}" -- "$cur")
|
||||||
|
|
||||||
if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
|
if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
|
||||||
COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") )
|
while IFS='' read -r c; do
|
||||||
|
COMPREPLY+=("$c")
|
||||||
|
done < <(compgen -W "${noun_aliases[*]}" -- "$cur")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
|
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
|
||||||
|
@ -160,7 +166,7 @@ __%[1]s_handle_filename_extension_flag()
|
||||||
__%[1]s_handle_subdirs_in_dir_flag()
|
__%[1]s_handle_subdirs_in_dir_flag()
|
||||||
{
|
{
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1
|
pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return
|
||||||
}
|
}
|
||||||
|
|
||||||
__%[1]s_handle_flag()
|
__%[1]s_handle_flag()
|
||||||
|
|
Loading…
Add table
Reference in a new issue