示例#1
0
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)
示例#2
0
文件: cli.py 项目: nijel/osc2
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)
示例#3
0
文件: shell.py 项目: vikas-lamba/osc2
    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()
示例#4
0
文件: shell.py 项目: bergmannf/osc2
    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()
示例#5
0
文件: cli.py 项目: bergmannf/osc2
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)
示例#6
0
文件: cli.py 项目: vikas-lamba/osc2
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)