-
Notifications
You must be signed in to change notification settings - Fork 124
Autocompleter #409
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
Autocompleter #409
Conversation
…e completion. Saving state - more to come.
…tch because they were failing for me. Added detection of ==SUPPRESS== in subcommand group names to avoid printing it in the help hint. Added some examples to tab_autocompletion to demonstrate how to tie in to cmd2 path_complete
NOTES: - I didn't implement this correctly because I don't know how to programmatically determine the version of argcomplete; instead I based it on the version of Python - We should make sure this works correctly even if no version of argcomplete is installed
Codecov Report
@@ Coverage Diff @@
## master #409 +/- ##
==========================================
- Coverage 89.76% 89.45% -0.32%
==========================================
Files 8 8
Lines 2560 2579 +19
==========================================
+ Hits 2298 2307 +9
- Misses 262 272 +10
Continue to review full report at Codecov.
|
| # not installed, skip the rest of the file | ||
| pass | ||
|
|
||
| DEFAULT_COMPLETER = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anselor Would you please review the changes I made to your PR. These changes were to support older versions of argcomplete which have a few API differences including:
FilesCompleteris not accessible at the top level- Fewer keyword arguments to an
__init__method
These older versions of argcomplete would commonly be found on older versions, in particular Python 3.4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
|
|
||
| if isinstance(arg_choices, tuple) and len(arg_choices) > 0 and callable(arg_choices[0]): | ||
| completer = arg_choices[0] | ||
| # if arg_choices is a tuple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks OK to me
| prefix = '{}{}'.format(flags, param) | ||
| else: | ||
| prefix = '{}'.format(str(action.dest).upper()) | ||
| if action.dest != SUPPRESS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this PR close Issue #407? If so, you should mark it as doing so in the description so that it auto-closes on merge.
Resolves #407