예제 #1
0
class SimpleProgOptions(usage.Options):
    """
    Command-line options for a `Silly` imaginary program
    """

    optFlags = [
        ["color", "c", "Turn on color output"],
        ["gray", "g", "Turn on gray-scale output"],
        ["verbose", "v", "Verbose logging (may be specified more than once)"],
    ]

    optParameters = [
        ["optimization", None, "5", "Select the level of optimization (1-5)"],
        ["accuracy", "a", "3", "Select the level of accuracy (1-3)"],
    ]

    compData = Completions(
        descriptions={
            "color": "Color on",
            "optimization": "Optimization level"
        },
        multiUse=["verbose"],
        mutuallyExclusive=[["color", "gray"]],
        optActions={
            "optimization":
            CompleteList(["1", "2", "3", "4", "5"], descr="Optimization?"),
            "accuracy":
            _accuracyAction,
        },
        extraActions=[CompleteFiles(descr="output file")],
    )

    def opt_X(self):
        """
예제 #2
0
class SimpleProgOptions(usage.Options):
    """
    Command-line options for a `Silly` imaginary program
    """
    optFlags = [
        ['color', 'c', 'Turn on color output'],
        ['gray', 'g', 'Turn on gray-scale output'],
        ['verbose', 'v', 'Verbose logging (may be specified more than once)'],
    ]

    optParameters = [
        ['optimization', None, '5', 'Select the level of optimization (1-5)'],
        ['accuracy', 'a', '3', 'Select the level of accuracy (1-3)'],
    ]

    compData = Completions(descriptions={
        'color': 'Color on',
        'optimization': 'Optimization level'
    },
                           multiUse=['verbose'],
                           mutuallyExclusive=[['color', 'gray']],
                           optActions={
                               'optimization':
                               CompleteList(['1', '2', '3', '4', '5'],
                                            descr='Optimization?'),
                               'accuracy':
                               _accuracyAction
                           },
                           extraActions=[CompleteFiles(descr='output file')])

    def opt_X(self):
        """
예제 #3
0
class FighterAceExtendedOptions(FighterAceOptions):
    """
    Extend the options and zsh metadata provided by FighterAceOptions.
    _shellcomp must accumulate options and metadata from all classes in the
    hiearchy so this is important to test.
    """

    optFlags = [[
        "no-stalls", None, "Turn off the ability to stall your aircraft"
    ]]
    optParameters = [[
        "reality-level", None, "Select the level of physics reality (1-5)", "5"
    ]]

    compData = Completions(
        descriptions={"no-stalls": "Can't stall your plane"},
        optActions={"reality-level": Completer(descr="Physics reality level")},
    )

    def opt_nocrash(self):
        """
        Select that you can't crash your plane
        """

    def opt_difficulty(self, difficulty):
        """
예제 #4
0
class FighterAceExtendedOptions(FighterAceOptions):
    """
    Extend the options and zsh metadata provided by FighterAceOptions.
    _shellcomp must accumulate options and metadata from all classes in the
    hiearchy so this is important to test.
    """
    optFlags = [['no-stalls', None,
                 'Turn off the ability to stall your aircraft']]
    optParameters = [['reality-level', None,
                      'Select the level of physics reality (1-5)', '5']]

    compData = Completions(
        descriptions={'no-stalls' : 'Can\'t stall your plane'},
        optActions={'reality-level' :
                        Completer(descr='Physics reality level')}
        )

    def opt_nocrash(self):
        """
        Select that you can't crash your plane
        """


    def opt_difficulty(self, difficulty):
        """
예제 #5
0
class FighterAceOptions(usage.Options):
    """
    Command-line options for an imaginary `Fighter Ace` game
    """

    optFlags = [
        ["fokker", "f", "Select the Fokker Dr.I as your dogfighter aircraft"],
        ["albatros", "a", "Select the Albatros D-III as your dogfighter aircraft"],
        ["spad", "s", "Select the SPAD S.VII as your dogfighter aircraft"],
        ["bristol", "b", "Select the Bristol Scout as your dogfighter aircraft"],
        ["physics", "p", "Enable secret Twisted physics engine"],
        ["jam", "j", "Enable a small chance that your machine guns will jam!"],
        ["verbose", "v", "Verbose logging (may be specified more than once)"],
    ]  # type: List[List[Optional[str]]]

    optParameters = [
        ["pilot-name", None, "What's your name, Ace?", "Manfred von Richthofen"],
        ["detail", "d", "Select the level of rendering detail (1-5)", "3"],
    ]  # type: List[List[Optional[str]]]

    subCommands = [
        ["server", None, FighterAceServerOptions, "Start FighterAce game-server."],
    ]

    compData = Completions(
        descriptions={"physics": "Twisted-Physics", "detail": "Rendering detail level"},
        multiUse=["verbose"],
        mutuallyExclusive=[["fokker", "albatros", "spad", "bristol"]],
        optActions={"detail": CompleteList(["1" "2" "3" "4" "5"])},
        extraActions=[CompleteFiles(descr="saved game file to load")],
    )

    def opt_silly(self):
        # A silly option which nobody can explain
        """ """
예제 #6
0
 class OddFighterAceOptions(FighterAceExtendedOptions):
     # since "fokker", etc, are already defined as mutually-
     # exclusive on the super-class, defining them again here forces
     # the corner-case to be exercised.
     optFlags = [['anatra', None,
                  'Select the Anatra DS as your dogfighter aircraft']]
     compData = Completions(
                     mutuallyExclusive=[['anatra', 'fokker', 'albatros',
                                         'spad', 'bristol']])
예제 #7
0
class FighterAceOptions(usage.Options):
    """
    Command-line options for an imaginary `Fighter Ace` game
    """
    optFlags = [
        ['fokker', 'f', 'Select the Fokker Dr.I as your dogfighter aircraft'],
        [
            'albatros', 'a',
            'Select the Albatros D-III as your dogfighter aircraft'
        ],
        ['spad', 's', 'Select the SPAD S.VII as your dogfighter aircraft'],
        [
            'bristol', 'b',
            'Select the Bristol Scout as your dogfighter aircraft'
        ],
        ['physics', 'p', 'Enable secret Twisted physics engine'],
        ['jam', 'j', 'Enable a small chance that your machine guns will jam!'],
        ['verbose', 'v', 'Verbose logging (may be specified more than once)'],
    ]

    optParameters = [
        [
            'pilot-name', None, "What's your name, Ace?",
            'Manfred von Richthofen'
        ],
        ['detail', 'd', 'Select the level of rendering detail (1-5)', '3'],
    ]

    subCommands = [
        [
            'server', None, FighterAceServerOptions,
            'Start FighterAce game-server.'
        ],
    ]

    compData = Completions(
        descriptions={
            'physics': 'Twisted-Physics',
            'detail': 'Rendering detail level'
        },
        multiUse=['verbose'],
        mutuallyExclusive=[['fokker', 'albatros', 'spad', 'bristol']],
        optActions={'detail': CompleteList(['1'
                                            '2'
                                            '3'
                                            '4'
                                            '5'])},
        extraActions=[CompleteFiles(descr='saved game file to load')])

    def opt_silly(self):
        # A silly option which nobody can explain
        """ """
예제 #8
0
 class TmpOptions2(FighterAceExtendedOptions):
     # Note that 'foo' and 'bar' are not real option
     # names defined in this class
     compData = Completions(mutuallyExclusive=[("foo", "bar")])
예제 #9
0
 class TmpOptions(FighterAceExtendedOptions):
     # Note typo of detail
     compData = Completions(optActions={'detaill': None})