Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

How to autocomplete file paths? #16

Closed
bloudermilk opened this Issue Oct 13, 2012 · 9 comments

Comments

Projects
None yet
2 participants

One of my commands simply accepts a file path as a parameter but I can't seem to figure out how to re-enable native autocompletion. Is this possible?

Here's the sub in question if it helps: pilot-install.

@qrush would love to get your advice on this!

Contributor

qrush commented Nov 1, 2012

It doesn't seem like the script linked uses autocompletions at all. Have you read:

https://github.com/37signals/sub#autocompletion

Basically you could have:

# Provide pilot completions
if [ "$1" = "--complete" ]; then
  exec ls
fi

@qrush I've read referenced documentation and successfully implemented autocompletion for a couple commands already. It seems like if I wanted to do a traditional path autocomplete I would need to have access to the partial argument being completed. Is that right?

@qrush not sure if this fell off your radar or you've just been busy...

Contributor

qrush commented Nov 30, 2012

Yes, both, and I've been on vacation all this week. I'm really not sure of the best way to do this other than what I provided earlier, sorry.

No worries, thanks for your help.

chrisjaure added a commit to chrisjaure/sub that referenced this issue Dec 4, 2012

fall through to default bash completion
When there are no completions for a command, fall through to default bash completion. Fixes #16.

I also added the patch from #12.
Contributor

qrush commented Dec 7, 2012

Hey @bloudermilk does #27 work for you?

@qrush yes, thank you!

@bloudermilk bloudermilk closed this Dec 7, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment