コード例 #1
0
ファイル: shell.py プロジェクト: scarabeusiv/osc2
 def _build_cmds(self, item_storage):
     """Builds a command hierarchy for the items."""
     description_cls = build_description("ItemSelector", {})
     self._root_cmd = build_command(description_cls)
     for cmd, item in item_storage.items():
         attrs = {"cmd": cmd, "help_str": str(item), "func": staticmethod(lambda info: item)}
         build_command(description_cls, self._root_cmd, **attrs)
コード例 #2
0
ファイル: shell.py プロジェクト: bergmannf/osc2
 def _build_cmds(self, item_storage):
     """Builds a command hierarchy for the items."""
     description_cls = build_description('ItemSelector', {})
     self._root_cmd = build_command(description_cls)
     for cmd, item in item_storage.iteritems():
         attrs = {'cmd': cmd,
                  'help_str': str(item),
                  'func': staticmethod(lambda info: item)}
         build_command(description_cls, self._root_cmd, **attrs)
コード例 #3
0
ファイル: shell.py プロジェクト: vikas-lamba/osc2
 def _build_cmds(self, item_storage):
     """Builds a command hierarchy for the items."""
     description_cls = build_description('ItemSelector', {})
     self._root_cmd = build_command(description_cls)
     for cmd, item in item_storage.iteritems():
         attrs = {
             'cmd': cmd,
             'help_str': str(item),
             'func': staticmethod(lambda info: item)
         }
         build_command(description_cls, self._root_cmd, **attrs)
コード例 #4
0
"""Defines commands for the interactive request shell."""

from osc2.cli.description import build_description, Option
from osc2.cli.cli import call
from osc2.cli.request.request import (RequestShellController,
                                      AbstractRequestShell)

ShellCommand = build_description('ShellCommand', {})


class RequestShellUI(ShellCommand):
    """Interactive request shell."""
    controller = RequestShellController()


class ChangeStateOptions(object):
    """Defines a set of options which are needed for a state change.

    All state changing commands should inherit from this class.

    """
    opt_message = Option('m', 'message', 'specify a message')
    opt_force = Option('f',
                       'force',
                       'try to force the state change',
                       action='store_true')


class RequestAccept(ShellCommand, RequestShellUI, ChangeStateOptions):
    """Accept a specific request.
コード例 #5
0
ファイル: shell.py プロジェクト: bergmannf/osc2
"""Defines commands for the interactive review shell."""

from osc2.cli.description import build_description, Option
from osc2.cli.cli import call
from osc2.cli.request.request import AbstractRequestShell
from osc2.cli.review.review import ReviewShellController
from osc2.cli.util.shell import TransparentRenderableItemSelectorFactory


ShellCommand = build_description('ShellCommand', {})
ItemSelectorFactory = TransparentRenderableItemSelectorFactory()


class ReviewShellUI(ShellCommand):
    """Interactive review shell."""
    controller = ReviewShellController()


class ReviewGlobalOptions(object):
    """Defines a set of global options.

    All review subcommands should inherit from this class.

    """
    opt_user = Option('U', 'user', 'use by_user')
    opt_group = Option('G', 'group', 'use by_group')
    opt_project = Option('P', 'project', 'use by_project')
    opt_package = Option('p', 'package', 'use by_package',
                         oargs='project/package', nargs=1, default=[])