Example #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)
Example #2
0
File: cli.py Project: 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)
Example #3
0
    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()
Example #4
0
    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()
Example #5
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
    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)
Example #6
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
    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)