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

fix using a Class for grouping commands --self shows as a flag #400

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion fire/completion.py
Expand Up @@ -404,7 +404,13 @@ def Completions(component, verbose=False):
Returns:
A list of completions for a command that would so far return the component.
"""
if inspect.isroutine(component) or inspect.isclass(component):
if inspect.isroutine(component):
spec = inspectutils.GetFullArgSpec(component)
if len(component.__qualname__.split('.')) > 1 and 'self' in spec.args:
spec.args.remove('self')
return _CompletionsFromArgs(spec.args + spec.kwonlyargs)

if inspect.isclass(component):
spec = inspectutils.GetFullArgSpec(component)
return _CompletionsFromArgs(spec.args + spec.kwonlyargs)

Expand Down