mbrubeck / compleat

Generate command-line completions using a simple DSL.
http://limpet.net/mbrubeck/2009/10/30/compleat.html
472 stars 18 forks source link

Trouble with sudo completion. #2

Open sorin-ionescu opened 14 years ago

sorin-ionescu commented 14 years ago

BASH completion for "sudo foo" works as expected when the "foo" completion is provided by the bash_completion package or written manually with the BASH completion API.

However, it refuses to work for completions generated by Compleat. sudo open[tab] results in the error bellow:

sudo open -bash: compgen: warning: -C option may not work as you expect compleat: : openFile: does not exist (No such file or directory) /Users/sorin/.compleat/open.usage

This is my open.usage for the Mac OS X open command: open [-a (|) | -b | -e | -t | -R | --reveal | -f]; open [-a ] [-g | --background | -n | --new | -W | --wait-apps] [--args] ; open [-h | --header ]; application = !mdfind 'kMDItemKind == Application' | awk 'BEGIN {FS=OFS="/"} {print $NF}' | sed 's/ /\ /g'; identifier = !mdfind 'kMDItemKind == Application' | sed -e 's/ /\ /g' -e "s:':\':g" | xargs -n 1 mdls | grep 'kMDItemCFBundleIdentifier' | cut -d '=' -f 2 | sed 's/^ "(.*)"$/\1/g'

sorin-ionescu commented 14 years ago

I forgot to mention that despite what Compleat says, the file exists. It works fine when "sudo" is not prepended.

mbrubeck commented 14 years ago

Thanks for the report! This is definitely a bug in compleat, and I'll try to fix it. Thanks for the open.usage file, too.

sorin-ionescu commented 14 years ago

Thank you. If you are also on Mac, could you please provide a binary download? Thank you. Compleat is awesome.