Skip to content

Commit

Permalink
Merge pull request #386 from Cronos87/master
Browse files Browse the repository at this point in the history
Now autocompletion display the text helper for each command
  • Loading branch information
nicoulaj committed Feb 17, 2016
2 parents 99cc7ea + 4b94fd2 commit 6953a4f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/_console
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# -------
#
# * loranger (https://github.com/loranger)
# * Yohan Tambè (https://github.com/Cronos87)
#
# ------------------------------------------------------------------------------

Expand All @@ -43,11 +44,20 @@ _find_console () {
}

_console_get_command_list () {
`_find_console` --no-ansi | sed "1,/Available commands/d" | awk '/ [a-z]+/ { print $1 }'
IFS=" "
`_find_console` --no-ansi | \
sed "1,/Available commands/d" | \
awk '/ [a-z]+/ { print $0 }' | \
sed -E 's/^[ ]+//g' | \
sed -E 's/[:]+/\\:/g' | \
sed -E 's/[ ]{2,}/\:/g'
}

_console () {
compadd `_console_get_command_list`
local -a commands
IFS=$'\n'
commands=(`_console_get_command_list`)
_describe 'commands' commands
}

compdef _console php console
Expand Down

0 comments on commit 6953a4f

Please sign in to comment.