-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathcql-completion.bash
More file actions
executable file
·111 lines (93 loc) · 2.48 KB
/
cql-completion.bash
File metadata and controls
executable file
·111 lines (93 loc) · 2.48 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!bash
#
# bash completion for cql (http://covenantsql.io)
#
_cql_comp()
{
COMPREPLY=( $(compgen -W "$1" -- ${word}) )
}
_cql_help_generate()
{
opts=$(cql generate -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "config public ${opts//\\n/ }"
}
_cql_help_console()
{
opts=$(cql console -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_create()
{
opts=$(cql create -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_drop()
{
opts=$(cql drop -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "covenantsql:// ${opts//\\n/ }"
}
_cql_help_wallet()
{
opts=$(cql wallet -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_transfer()
{
opts=$(cql transfer -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_grant()
{
opts=$(cql grant -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_mirror()
{
opts=$(cql mirror -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_explorer()
{
opts=$(cql explorer -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_adapter()
{
opts=$(cql adapter -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_idminer()
{
opts=$(cql idminer -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_rpc()
{
opts=$(cql rpc -help 2>&1 | grep ' -' | sed 's/ //' | cut -d ' ' -f 1)
_cql_comp "${opts//\\n/ }"
}
_cql_help_version()
{
return
}
_cql()
{
COMPREPLY=()
local word="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
case "${COMP_CWORD}" in
1)
local opts="generate console create drop wallet transfer \
grant mirror explorer adapter idminer rpc version"
COMPREPLY=( $(compgen -W "${opts}" -- ${word}) );;
*)
local command="${COMP_WORDS[1]}"
eval "_cql_help_$command" 2> /dev/null ;;
# *)
# local command="${COMP_WORDS[1]}"
# local subcommand="${COMP_WORDS[2]}"
# eval "_cql_${command}_${subcommand}" 2> /dev/null && return
# eval "_cql_$command" 2> /dev/null ;;
esac
}
complete -F _cql cql