Oh-My-ZSH Autocomplete Script append '/' (Forward-Slash) to completion
I'm trying to create an autocomplete plugin for Oh-My-ZSH, everything works fine except on hitting TAB the completion is followed by numbers of / .
Here are the codes that I currently have:
local curcontext="$curcontext" state line _opts _bundles ret=1
_arguments -C \
'1: :->cmds' \
'*:: :->args' && ret=0
case $state in
cmds)
_values "Available command" \
'up [Put the application into live mode]' \
'down [Put the application into maintenance mode]' \
ret=0
;;
args)
case $line[1] in
up)
_values \
'one-time [Only for first time]' \
'persist [for as long as you want]' \
ret=0
;;
esac
;;
esac
return ret
Now whenever I type the command and hit TAB It previews everything fine but on selecting something from available commands it turns out to be having some / following, like this:
app-tester TAB TAB
app-tester up/ / / /
or
app-tester up TAB TAB
app-tester up:one-time/ / / /
I'm kinda new to ZSH scripting and cannot figure out what could be the problem.
I'm trying to create an autocomplete plugin for Oh-My-ZSH, everything works fine except on hitting TAB the completion is followed by numbers of / .
Here are the codes that I currently have:
local curcontext="$curcontext" state line _opts _bundles ret=1
_arguments -C \
'1: :->cmds' \
'*:: :->args' && ret=0
case $state in
cmds)
_values "Available command" \
'up [Put the application into live mode]' \
'down [Put the application into maintenance mode]' \
ret=0
;;
args)
case $line[1] in
up)
_values \
'one-time [Only for first time]' \
'persist [for as long as you want]' \
ret=0
;;
esac
;;
esac
return ret
Now whenever I type the command and hit TAB It previews everything fine but on selecting something from available commands it turns out to be having some / following, like this:
app-tester TAB TAB
app-tester up/ / / /
or
app-tester up TAB TAB
app-tester up:one-time/ / / /
I'm kinda new to ZSH scripting and cannot figure out what could be the problem.
No comments:
Post a Comment