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

Method execute

keepercommander/commands/utils.py:2182–2239  ·  view source on GitHub ↗
(self, params, **kwargs)

Source from the content-addressed store, hash-verified

2180 print()
2181
2182 def execute(self, params, **kwargs):
2183 help_commands = kwargs.get('command')
2184 show_legacy = kwargs.get('legacy', False)
2185 if not help_commands:
2186 from ..cli import display_command_help
2187 display_command_help(
2188 params.enterprise_ec_key,
2189 show_legacy=show_legacy,
2190 show_nested_share_folder=not params.is_feature_disallowed('keeper_drive')
2191 )
2192 return
2193
2194 if isinstance(help_commands, list) and len(help_commands) > 0:
2195 cmd = help_commands[0]
2196
2197 # Handle "help basics" special case
2198 if cmd.lower() == 'basics':
2199 self.display_basics_help()
2200 return
2201
2202 help_commands = help_commands[1:]
2203 if cmd in aliases:
2204 ali = aliases[cmd]
2205 if type(ali) == tuple:
2206 cmd = ali[0]
2207 else:
2208 cmd = ali
2209
2210 if cmd in commands:
2211 command = commands[cmd]
2212 elif cmd in enterprise_commands:
2213 command = enterprise_commands[cmd]
2214 elif cmd in msp_commands:
2215 command = msp_commands[cmd]
2216 else:
2217 command = None
2218
2219 if isinstance(command, Command):
2220 parser = command.get_parser()
2221 if parser:
2222 parser.print_help()
2223 elif isinstance(command, GroupCommand):
2224 if len(help_commands) == 0:
2225 command.print_help(command=cmd)
2226 else:
2227 while len(help_commands) > 0:
2228 cmd = help_commands[0]
2229 help_commands = help_commands[1:]
2230 if cmd in command.subcommands:
2231 subcommand = command.subcommands[cmd]
2232 if isinstance(subcommand, Command):
2233 parser = subcommand.get_parser()
2234 if parser:
2235 parser.print_help()
2236 break
2237 elif isinstance(subcommand, GroupCommand):
2238 command = subcommand
2239 command.print_help(command=cmd)

Callers

nothing calls this directly

Calls 6

display_basics_helpMethod · 0.95
display_command_helpFunction · 0.85
is_feature_disallowedMethod · 0.80
getMethod · 0.45
get_parserMethod · 0.45
print_helpMethod · 0.45

Tested by

no test coverage detected