summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2018-01-24 08:47:23 +0000
committerJürg Billeter <j@bitron.ch>2018-01-31 15:42:04 +0000
commit315c4ef768d3c21ea7484a35052c17fb2e7ec1c4 (patch)
tree90d1b20881cbe0c73da65c0864a29c489c4453f8
parent4c116c6d2141f33a0ebfe16ec72bf9bc409751d6 (diff)
downloadbuildstream-315c4ef768d3c21ea7484a35052c17fb2e7ec1c4.tar.gz
_frontend: remove unused 'ctx' param from override
The 'ctx' parameter is carefully threaded through to 'complete_target', but it doesn't actually use it. Remove the parameter from unused places.
-rw-r--r--buildstream/_frontend/complete.py12
-rw-r--r--buildstream/_frontend/main.py9
2 files changed, 8 insertions, 13 deletions
diff --git a/buildstream/_frontend/complete.py b/buildstream/_frontend/complete.py
index c3e371cac..fa986ee6b 100644
--- a/buildstream/_frontend/complete.py
+++ b/buildstream/_frontend/complete.py
@@ -209,13 +209,12 @@ def is_incomplete_argument(current_params, cmd_param):
return False
-def get_user_autocompletions(ctx, args, incomplete, cmd_param, override):
+def get_user_autocompletions(args, incomplete, cmd_param, override):
"""
- :param ctx: context associated with the parsed command
:param args: full list of args typed before the incomplete arg
:param incomplete: the incomplete text of the arg to autocomplete
:param cmd_param: command definition
- :param override: a callable (cmd_param, ctx, args, incomplete) that will be
+ :param override: a callable (cmd_param, args, incomplete) that will be
called to override default completion based on parameter type. Should raise
'CompleteUnhandled' if it could not find a completion.
:return: all the possible user-specified completions for the param
@@ -224,7 +223,6 @@ def get_user_autocompletions(ctx, args, incomplete, cmd_param, override):
# Use the type specific default completions unless it was overridden
try:
return override(cmd_param=cmd_param,
- ctx=ctx,
args=args,
incomplete=incomplete)
except CompleteUnhandled:
@@ -237,7 +235,7 @@ def get_choices(cli, prog_name, args, incomplete, override):
:param prog_name: the program that is running
:param args: full list of args typed before the incomplete arg
:param incomplete: the incomplete text of the arg to autocomplete
- :param override: a callable (cmd_param, ctx, args, incomplete) that will be
+ :param override: a callable (cmd_param, args, incomplete) that will be
called to override default completion based on parameter type. Should raise
'CompleteUnhandled' if it could not find a completion.
:return: all the possible completions for the incomplete
@@ -270,14 +268,14 @@ def get_choices(cli, prog_name, args, incomplete, override):
# completion for option values by choices
for cmd_param in ctx.command.params:
if isinstance(cmd_param, Option) and is_incomplete_option(all_args, cmd_param):
- choices.extend(get_user_autocompletions(ctx, all_args, incomplete, cmd_param, override))
+ choices.extend(get_user_autocompletions(all_args, incomplete, cmd_param, override))
found_param = True
break
if not found_param:
# completion for argument values by choices
for cmd_param in ctx.command.params:
if isinstance(cmd_param, Argument) and is_incomplete_argument(ctx.params, cmd_param):
- choices.extend(get_user_autocompletions(ctx, all_args, incomplete, cmd_param, override))
+ choices.extend(get_user_autocompletions(all_args, incomplete, cmd_param, override))
found_param = True
break
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index 48c282f53..7997b45ee 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -51,14 +51,12 @@ INDENT = 4
##################################################################
# Special completion for completing the bst elements in a project dir
-def complete_target(ctx, args, incomplete):
+def complete_target(args, incomplete):
"""
- :param ctx: context associated with the parsed command
:param args: full list of args typed before the incomplete arg
:param incomplete: the incomplete text to autocomplete
:return: all the possible user-specified completions for the param
"""
- app = ctx.obj
# First resolve the directory, in case there is an
# active --directory/-C option
@@ -97,10 +95,9 @@ def complete_target(ctx, args, incomplete):
return complete_path("File", incomplete, base_directory=base_directory)
-def override_completions(cmd_param, ctx, args, incomplete):
+def override_completions(cmd_param, args, incomplete):
"""
:param cmd_param: command definition
- :param ctx: context associated with the parsed command
:param args: full list of args typed before the incomplete arg
:param incomplete: the incomplete text to autocomplete
:return: all the possible user-specified completions for the param
@@ -115,7 +112,7 @@ def override_completions(cmd_param, ctx, args, incomplete):
cmd_param.name == 'except_' or
cmd_param.opts == ['--track'] or
cmd_param.opts == ['--track-except']):
- return complete_target(ctx, args, incomplete)
+ return complete_target(args, incomplete)
raise CompleteUnhandled()