def execute(args=None): """Executes a command specified by args. Keyword arguments: args -- represents the command to be executed (default: None that is the command is read from stdin) """ info = parse.parse(OscCommand, args) apiurl = 'api' if 'apiurl' in info: apiurl = info.apiurl info.set('apiurl', _init(apiurl)) info.func(info)
def _execute(self, inp): """Executes user specified command. inp is the user input. The return value of the executed function/method is returned. """ args = self._split_input(inp) info = parse.parse(self._root_cmd_cls(), args) self._augment_info(info) try: return info.func(info) finally: # setup completion again because another shell # might have been executed self._setup_completion()
def execute(args=None): """Executes a command specified by args. Keyword arguments: args -- represents the command to be executed (default: None that is the command is read from stdin) """ info = parse.parse(OscCommand, args) apiurl = 'api' if 'apiurl' in info: apiurl = info.apiurl elif getattr(info, 'path') is not None: if isinstance(info.path, Sequence) and info.path: apiurl = info.path[0].project_obj().apiurl else: apiurl = info.path.project_obj().apiurl info.set('apiurl', _init(apiurl)) info.func(info)