-
Notifications
You must be signed in to change notification settings - Fork 34
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
Custom completion logic? #34
Comments
@travis-bear, you'd need to add a custom script for bash/zsh and then need to register it. You can take an example of how we do in DVC: To go into steps, first you need to add custom scripts to generate completions, eg: Then, you'd have to register the function that you'd want to call for that particular completion for zsh and bash. At last, you just need to specify it for the particular option to autocomplete for. |
@skshetry @casperdcl what if I need custom actions that depend on other provided arguments? e.g. https://github.com/kislyuk/argcomplete has the following example in the README.md: ./describe_github_user.py --organization heroku --member <TAB> def github_org_members(prefix, parsed_args, **kwargs):
resource = "https://api.github.com/orgs/{org}/members".format(org=parsed_args.organization)
return (member['login'] for member in requests.get(resource).json() if member['login'].startswith(prefix))
parser = argparse.ArgumentParser()
parser.add_argument("--organization", help="GitHub organization")
parser.add_argument("--member", help="GitHub member").completer = github_org_members I need to know the value of |
@balta2ar that level of inter-dependent completion ( |
I didn't see any info on how to set up custom completion logic. E.g. generate a list of completions that are the result of a sql query, etc. It's unclear if this is simply not supported, or merely a gap in the current documentation.
The text was updated successfully, but these errors were encountered: