Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

How to autocomplete file paths? #16

Closed
bloudermilk opened this Issue · 9 comments

2 participants

@bloudermilk

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?

@bloudermilk

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

@bloudermilk

@qrush would love to get your advice on this!

@qrush
Owner

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
@bloudermilk

@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?

@bloudermilk

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

@qrush
Owner

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.

@bloudermilk

No worries, thanks for your help.

@chrisjaure chrisjaure referenced this issue from a commit in chrisjaure/sub
@chrisjaure chrisjaure 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.
2abfad7
@qrush
Owner

Hey @bloudermilk does #27 work for you?

@bloudermilk

@qrush yes, thank you!

@bloudermilk bloudermilk closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.