INNER CODE UNIT · Python
make_context
flyteorg/flytekit · flytekit/clis/flyte_cli/main.py:483
def make_context(self, cmd_name, args, parent=None):
# This list represents the set of args/flags that can be, and are, set on both the parent and subcommand.
prefix_args = []
for param in self.params:
if (
param.name in type(self)._PASSABLE_ARGS
and param.name in parent.params
and parent.params[param.name] is not None
):
prefix_args.extend([type(self)._PASSABLE_ARGS[param.name], str(parent.params[param.name])])
# For flags, we don't append the value of the flag, otherwise click will fail to parse
if param.name in type(self)._PASSABLE_FLAGS and param.name in parent.params and parent.params[param.name]:
prefix_args.append(type(self)._PASSABLE_FLAGS[param.name])
# Pass the parameters to the subcommand "setup-config", so both of the below commands can work.
# flyte-cli -h localhost:30081 -i setup-config
# flyte-cli setup-config -h localhost:30081 -i