-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompletion.go
39 lines (34 loc) · 899 Bytes
/
completion.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
const bashCompletionScript = `
#! /bin/bash
_kubecnf_completion() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="add remove list rollback completion --help -h --config -c"
case "${prev}" in
kubecnf)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
add)
COMPREPLY=( $(compgen -f ${cur}) )
return 0
;;
remove)
COMPREPLY=( $(compgen -W "$(kubecnf remove --generate-bash-completion)" -- ${cur}) )
return 0
;;
--config|-c)
COMPREPLY=( $(compgen -f ${cur}) )
return 0
;;
*)
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _kubecnf_completion kubecnf
`