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

Method execute

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

Source from the content-addressed store, hash-verified

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