Skip to content

Conversation

@anselor
Copy link
Contributor

@anselor anselor commented May 19, 2018

Resolves #407

anselor added 5 commits May 18, 2018 18:53
…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
@anselor anselor requested a review from tleonhardt as a code owner May 19, 2018 20:12
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
Copy link

codecov bot commented May 19, 2018

Codecov Report

Merging #409 into master will decrease coverage by 0.31%.
The diff coverage is 56.25%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
cmd2/pyscript_bridge.py 96.55% <100%> (ø) ⬆️
cmd2/argcomplete_bridge.py 18.39% <28.57%> (+1.1%) ⬆️
cmd2/argparse_completer.py 89.67% <60.86%> (-1.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a38e3f2...34c7e65. Read the comment docs.

# not installed, skip the rest of the file
pass

DEFAULT_COMPLETER = None
Copy link
Member

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:

  • FilesCompleter is 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.

Copy link
Contributor Author

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
Copy link
Member

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:
Copy link
Member

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.

@tleonhardt tleonhardt merged commit c2594ff into master May 21, 2018
@tleonhardt tleonhardt deleted the autocompleter branch May 21, 2018 16:19
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.

3 participants