-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_rwc
112 lines (105 loc) · 2.96 KB
/
_rwc
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
112
#compdef rwc
autoload -U is-at-least
_rwc() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'-b[Print the byte counts]' \
'--bytes[Print the byte counts]' \
'-c[Print the character counts]' \
'--chars[Print the character counts]' \
'-w[Print the word counts]' \
'--words[Print the word counts]' \
'-l[Print the line counts]' \
'--lines[Print the line counts]' \
'-L[Print the maximum line width (Unicode)]' \
'--longest-line[Print the maximum line width (Unicode)]' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'*::paths -- The path(s) you should provide
Note when without FILE or it is `-`, read standard input (stop inputting by `CTRL-D`)
The file read from stdin will prefix with `Input/`, and the other will prefix with `./`:_files' \
":: :_rwc_commands" \
"*::: :->rust-wc" \
&& ret=0
case $state in
(rust-wc)
words=($line[2] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rwc-command-$line[2]:"
case $line[2] in
(all)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'*::paths -- The path(s) you should provide:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_rwc__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:rwc-help-command-$line[1]:"
case $line[1] in
(all)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
}
(( $+functions[_rwc_commands] )) ||
_rwc_commands() {
local commands; commands=(
'all:Enabled all available options' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rwc commands' commands "$@"
}
(( $+functions[_rwc__all_commands] )) ||
_rwc__all_commands() {
local commands; commands=()
_describe -t commands 'rwc all commands' commands "$@"
}
(( $+functions[_rwc__help__all_commands] )) ||
_rwc__help__all_commands() {
local commands; commands=()
_describe -t commands 'rwc help all commands' commands "$@"
}
(( $+functions[_rwc__help_commands] )) ||
_rwc__help_commands() {
local commands; commands=(
'all:Enabled all available options' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'rwc help commands' commands "$@"
}
(( $+functions[_rwc__help__help_commands] )) ||
_rwc__help__help_commands() {
local commands; commands=()
_describe -t commands 'rwc help help commands' commands "$@"
}
_rwc "$@"