File tree Expand file tree Collapse file tree 1 file changed +75
-0
lines changed Expand file tree Collapse file tree 1 file changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ # usine completion
2
+
3
+ have usine.py &&
4
+ {
5
+
6
+ _usine_modules ()
7
+ {
8
+ COMPREPLY=( " ${COMPREPLY[@]} " $( compgen -W \
9
+ " $( usine.py | \
10
+ sed -ne ' s/ \([a-z0-9/_.]*\).*/\1/p' ) " \
11
+ -- " $cur " ) )
12
+ }
13
+
14
+ _usine_items ()
15
+ {
16
+ COMPREPLY=( " ${COMPREPLY[@]} " $( compgen -W \
17
+ " $( usine.py $1 | \
18
+ sed -ne ' s/ \([a-z0-9/_.]*\).*/\1/p' ) " \
19
+ -- " $cur " ) )
20
+ }
21
+
22
+ _usine_actions ()
23
+ {
24
+ COMPREPLY=( " ${COMPREPLY[@]} " $( compgen -W \
25
+ " $( usine.py $1 $2 | \
26
+ sed -ne ' s/ \([a-z0-9/_.]*\).*/\1/p' ) " \
27
+ -- " $cur " ) )
28
+ }
29
+
30
+ _usine ()
31
+ {
32
+ local cur prev module item action
33
+
34
+ COMPREPLY=()
35
+ _get_comp_words_by_ref cur prev
36
+
37
+ set -- " ${COMP_WORDS[@]} "
38
+ shift
39
+ module=$1
40
+ item=$2
41
+ action=$3
42
+
43
+ if [[ " $action " ]]; then
44
+ if [[ " $cur " ]]; then
45
+ _usine_actions $module $item
46
+ fi
47
+ elif [[ " $item " ]]; then
48
+ if [[ " $cur " ]]; then
49
+ _usine_items $module
50
+ else
51
+ _usine_actions $module $item
52
+ fi
53
+ elif [[ " $module " ]]; then
54
+ if [[ " $cur " ]]; then
55
+ _usine_modules
56
+ else
57
+ _usine_items $module
58
+ fi
59
+ else
60
+ _usine_modules
61
+ fi
62
+
63
+ return 0
64
+ }
65
+
66
+ complete -F _usine usine.py
67
+ }
68
+
69
+ # Local variables:
70
+ # mode: shell-script
71
+ # sh-basic-offset: 4
72
+ # sh-indent-comment: t
73
+ # indent-tabs-mode: nil
74
+ # End:
75
+ # ex: ts=4 sw=4 et filetype=sh
You can’t perform that action at this time.
0 commit comments