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