-
Notifications
You must be signed in to change notification settings - Fork 15
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
Use argcomplete #162
Use argcomplete #162
Conversation
This looks neat. I think we should probably remove the |
I think we should add You said
However, the
What is the "executable" in this case? when you #!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from scuba.__main__ import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main()) Do you know for sure that Edit: Okay, I see this in the docs:
|
Another enhancement would be to add a completer to the |
I considered adding a completer to I noticed we currently do a |
Simplicity, mostly.
|
Those are all sound reasons and it makes sense to me. Just FYI though, these changes will add |
Should we make |
I think that strikes a good balance if we're trying to keep the hard dependencies to a minimum. We can use the |
0cfb113
to
c6d64d6
Compare
Per JonathonReinhart#162 (comment) Also removes associated tests Also removes some unused imports
Per discussion in JonathonReinhart#162
Per discussion in JonathonReinhart#162
Per discussions on JonathonReinhart#162 An images completer is now present to list all available Docker images for the `--image` option. Fixes up the aliases completer to *not* give a suggestion when an alias has already been specified and to warn the user if no config file is present. Removed `get_paths_and_config()` and updated `find_config()` to return the loaded config. Fixes up and adds unit tests.
The `--list-aliases` option has been removed
'docker images' takes a '--format' option which allows one to specify a Go template for formatting the output. This avoids having to manually parse the default tabular output. References: - https://docs.docker.com/engine/reference/commandline/images/#format-the-output - https://golang.org/pkg/text/template/ - https://github.com/docker/cli/blob/abafad3df202/contrib/completion/bash/docker#L213-L231
I tried testing this on my Debian 10 machine, by installing The problem was that the pip/wheel-generated console script wasn't recognized by the autocompleter as a script it should follow. This was fixed in kislyuk/argcomplete#241 which first appeared (kislyuk/argcomplete@2559a34) in So note: If you're installing Scuba with pip from a wheel (the recommended method), you need I then tested:
Now it works! |
I pushed two commits that really simplify the way |
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.
Okay I think we're really close now. Do you want to fix these things up? If not, I can.
Good catch, I typically do a
Nice. I'm not super familiar with all the
I'm fine to make the changes. |
These changes are from JonathonReinhart#162 * Fix incorrect syntax in `requirements.txt` * Add version specifier for `argcomplete` based on a needed bug fix * Update `README.md` example `pip install` with argument completion support to use lowercase * Update `README.md` to include more details for activating bash completion * Move the completer functions to keep the argument parser defintion grouping and add an expected argument instead of using the `kwargs` catch-all * Fix a typo * Update a misleading variable name
There's one last thing that kind of stinks: If I have a
This isn't horrible, but it really hurts trying to find the alias you're looking for. This is in contrast with the way the Bash completion works for
I wonder if there's a way to accomplish something similar with Okay I set |
By setting always_complete_options=False, options will only be suggested if the user has enetered -
Closes #136
There is something that still needs addressed though. According to the argcomplete README, either global completion needs to be enabled and we need to add the string
PYTHON_ARGCOMPLETE_OK
to the top of the__main__.py
or a user will need to addeval "$(register-python-argcomplete scuba)"
to their.bashrc
in order to activateargcomplete
completion.Do we want to handle this? If so, how?