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

Method execute

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

Source from the content-addressed store, hash-verified

2097 print()
2098
2099 def execute(self, params, **kwargs):
2100 help_commands = kwargs.get('command')
2101 show_legacy = kwargs.get('legacy', False)
2102 if not help_commands:
2103 from ..cli import display_command_help
2104 display_command_help(
2105 params.enterprise_ec_key,
2106 show_legacy=show_legacy,
2107 show_nested_share_folder=not params.is_feature_disallowed('keeper_drive')
2108 )
2109 return
2110
2111 if isinstance(help_commands, list) and len(help_commands) > 0:
2112 cmd = help_commands[0]
2113
2114 # Handle "help basics" special case
2115 if cmd.lower() == 'basics':
2116 self.display_basics_help()
2117 return
2118
2119 help_commands = help_commands[1:]
2120 if cmd in aliases:
2121 ali = aliases[cmd]
2122 if type(ali) == tuple:
2123 cmd = ali[0]
2124 else:
2125 cmd = ali
2126
2127 if cmd in commands:
2128 command = commands[cmd]
2129 elif cmd in enterprise_commands:
2130 command = enterprise_commands[cmd]
2131 elif cmd in msp_commands:
2132 command = msp_commands[cmd]
2133 else:
2134 command = None
2135
2136 if isinstance(command, Command):
2137 parser = command.get_parser()
2138 if parser:
2139 parser.print_help()
2140 elif isinstance(command, GroupCommand):
2141 if len(help_commands) == 0:
2142 command.print_help(command=cmd)
2143 else:
2144 while len(help_commands) > 0:
2145 cmd = help_commands[0]
2146 help_commands = help_commands[1:]
2147 if cmd in command.subcommands:
2148 subcommand = command.subcommands[cmd]
2149 if isinstance(subcommand, Command):
2150 parser = subcommand.get_parser()
2151 if parser:
2152 parser.print_help()
2153 break
2154 elif isinstance(subcommand, GroupCommand):
2155 command = subcommand
2156 command.print_help(command=cmd)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected