Skip to content

Instantly share code, notes, and snippets.

@huseyin
Last active January 22, 2017 21:38
Show Gist options
  • Save huseyin/598a1855318070e7f0608bc1a2346f3e to your computer and use it in GitHub Desktop.
Save huseyin/598a1855318070e7f0608bc1a2346f3e to your computer and use it in GitHub Desktop.
#compdef scripts
#autoload
declare base_command
base_command=`SCRIPTS=scripts scripts help 2>/dev/null`
declare -A task_list
_tasks() {
_describe -t commands 'commands' task_list && return 0
}
while read -r hint; do
r=`echo $line | awk -F '#' '{printf("%s:%s", $1, $2)}'`
task_list+=("$r")
done < <$base_command
if [[ CURRENT -ge 2 ]]; then
_tasks
return 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment