Skip to content

Commit 121ab6c

Browse files
committed
refactor(plugin): use gawk, cleanup
1 parent aeaf5f4 commit 121ab6c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ahccli.plugin.zsh

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# AhcCli command completion
1313
_ahccli_command_list () {
14-
command $1 --help 2>/dev/null | sed "1,/Commands/d" | grep -v Run | awk '/ [a-z]+ / { print $2 }'
14+
command $1 --help 2>/dev/null | sed "1,/Commands/d" | gawk 'match($0, / ([a-z]+) [a-z]* /, c) { print c[1] }'
1515
}
1616

1717
# AhcCli option completion
@@ -23,9 +23,7 @@ _ahccli_option_list () {
2323
_ahccli () {
2424
local curcontext="$curcontext" state line cmd subcmd
2525
typeset -A opt_args
26-
_arguments \
27-
'1: :->cmd'\
28-
'*: :->opts'
26+
_arguments '1: :->cmd' '*: :->opts'
2927

3028
cmd=`echo $curcontext | gawk 'match($0, /\:([_a-z-]+)\:$/, c) { print c[1] }'`
3129
subcmd=`echo $line | awk '{print $1}'`

0 commit comments

Comments
 (0)