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

%run script arguments completion #11913

Open
anki-code opened this issue Oct 13, 2019 · 0 comments
Open

%run script arguments completion #11913

anki-code opened this issue Oct 13, 2019 · 0 comments

Comments

@anki-code
Copy link

Hello @minrk!

Is there a way to extend arguments completion for %run command? For example to add support of https://github.com/kislyuk/argcomplete

Example. I have test.py:

import argcomplete, argparse

def arg2completion(prefix, parsed_args, **kwargs):
  return ['aaa','bbb','bbc']

parser = argparse.ArgumentParser()
parser.add_argument("--arg1")
parser.add_argument("--arg2").completer = arg2completion

argcomplete.autocomplete(parser)
args = parser.parse_args()

Then I type run with TAB key it and get the possible args:

%run test.py --arg<TAB>
--arg1 --arg2

%run test.py --arg2 <TAB>
aaa bbb ccc

%run test.py --arg2 b<TAB>
bbb bbc

Thanks!

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

No branches or pull requests

1 participant