Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to filename completion if no other matches are found #186

Merged
merged 2 commits into from
Jun 23, 2015

Conversation

tschaub
Copy link
Contributor

@tschaub tschaub commented Jun 22, 2015

If calling a script with --get-yargs-completions doesn't result in any matches for the current word, we can fall back to the default filename completion.

See suggestion in #180 (comment).

@bcoe
Copy link
Member

bcoe commented Jun 22, 2015

@tschaub I like this a lot, let the bash do what it's good at 👍

@tschaub
Copy link
Contributor Author

tschaub commented Jun 22, 2015

0765cbc guards against bad output when trying to complete an option that doesn't match any configured options. Let me know if you'd like these squashed.


# if no match was found, fall back to filename completion
if [ ${#COMPREPLY[@]} -eq 0 ]; then
COMPREPLY=( $(compgen -f -- "${cur_word}" ) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome 👍

bcoe added a commit that referenced this pull request Jun 23, 2015
Default to filename completion if no other matches are found
@bcoe bcoe merged commit 5e5839d into yargs:master Jun 23, 2015
@tschaub tschaub deleted the path-completion branch June 23, 2015 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants