(self, params, args, **kwargs)
| 849 | self._aliases[alias] = verb |
| 850 | |
| 851 | def execute_args(self, params, args, **kwargs): # type: (KeeperParams, str, dict) -> any |
| 852 | if args.startswith('-- '): |
| 853 | args = args[3:].strip() |
| 854 | self.validate(params) |
| 855 | pos = args.find(' ') |
| 856 | if pos > 0: |
| 857 | verb = args[:pos].strip() |
| 858 | args = args[pos + 1:].strip() |
| 859 | else: |
| 860 | verb = args.strip() |
| 861 | args = '' |
| 862 | |
| 863 | print_help = False |
| 864 | if not verb: |
| 865 | verb = self.default_verb |
| 866 | print_help = True |
| 867 | if verb: |
| 868 | verb = verb.lower() |
| 869 | |
| 870 | if verb in self._aliases: |
| 871 | verb = self._aliases[verb] |
| 872 | |
| 873 | command = self._commands.get(verb) |
| 874 | if not command: |
| 875 | print_help = True |
| 876 | if verb not in ['--help', '-h', 'help', '']: |
| 877 | logging.warning('Invalid command: %s', verb) |
| 878 | |
| 879 | if print_help: |
| 880 | self.print_help(**kwargs) |
| 881 | |
| 882 | if command: |
| 883 | kwargs['action'] = verb |
| 884 | if command.is_authorised() and not params.session_token: |
| 885 | from .utils import LoginCommand |
| 886 | login_cmd = LoginCommand() |
| 887 | login_cmd.execute(params) |
| 888 | if not params.session_token: |
| 889 | return |
| 890 | |
| 891 | return command.execute_args(params, args, **kwargs) |
| 892 | |
| 893 | def print_help(self, **kwargs): |
| 894 | print(f'{kwargs.get("command")} command [--options]') |
nothing calls this directly
no test coverage detected