예제 #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 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
        """ """
예제 #4
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
        """ """
예제 #5
0
def _accuracyAction():
    # add tick marks just to exercise quoting
    return CompleteList(['1', '2', '3'], descr='Accuracy\'`?')
예제 #6
0
def _accuracyAction():
    # add tick marks just to exercise quoting
    return CompleteList(["1", "2", "3"], descr="Accuracy'`?")