MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / execute_args

Method execute_args

keepercommander/commands/base.py:752–780  ·  view source on GitHub ↗
(self, params, args, **kwargs)

Source from the content-addressed store, hash-verified

750 raise NotImplementedError()
751
752 def execute_args(self, params, args, **kwargs):
753 # type: (Command, KeeperParams, str, ...) -> Any
754
755 global parameter_pattern
756 try:
757 d = {}
758 d.update(kwargs)
759 self.extra_parameters = ''
760 parser = self._get_parser_safe()
761 envvars = params.environment_variables
762 args = '' if args is None else args
763 if parser:
764 # Update prog to match alias name (e.g., 'find-password' instead of 'clipboard-copy')
765 alias_cmd = d.get('command')
766 if alias_cmd and alias_cmd != parser.prog:
767 parser.prog = alias_cmd
768 args = expand_cmd_args(args, envvars)
769 args = normalize_output_param(args)
770 if self.support_extra_parameters():
771 opts, extra_args = parser.parse_known_args(shlex.split(args))
772 if extra_args:
773 self.extra_parameters = ' '.join(extra_args)
774 else:
775 opts = parser.parse_args(shlex.split(args))
776 d.update(opts.__dict__)
777
778 return self.execute(params, **d)
779 except ParseError as e:
780 logging.error(e)
781
782 def support_extra_parameters(self): # type: () -> bool
783 return False

Callers 2

do_commandFunction · 0.45
execute_argsMethod · 0.45

Calls 8

_get_parser_safeMethod · 0.95
executeMethod · 0.95
expand_cmd_argsFunction · 0.85
normalize_output_paramFunction · 0.85
getMethod · 0.80
updateMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected