コード例 #1
0
 class SubOptions2(Options):
     opts = [
         Opt('charlie', 'c', store=False),
         Opt('delta', 'd', store=str),
         Opt('golf', 'g', store=True),
         Opt('hotel', 'h', store=int)
     ]
コード例 #2
0
 class AppOptions(Options):
     cmds = {'cmd1|command1': SubOptions1, 'cmd2|command2': SubOptions2}
     opts = [
         Opt('alpha', 'a', store=True),
         Opt('bravo', 'b', store=int),
         Opt('charlie', 'c', store=1),
         Opt('delta', 'd', store=str)
     ]
コード例 #3
0
        class TestSubOptions(Options):
            desc = """
                short sub-command description string

                Long sub-command description string.
                """
            usage = '[options]'
            opts = [
                Opt('alpha', 'a', 'alpha help string', store=int),
                Opt('echo', 'e', 'echo help string', store=True),
                Opt('foxtrot', '', 'foxtrot help string', store=str)
            ]
コード例 #4
0
 class SubOptions1(Options):
     cmds = {'cmd1-1': SubSubOptions1}
     opts = [
         Opt('charlie', 'c', store=True),
         Opt('delta', 'd', store=float),
         Opt('echo', 'e', store={
             'a': 4,
             'b': 3,
             'c': 2,
             'd': 1
         })
     ]
コード例 #5
0
        class TestOptions(Options):
            desc = """
                short command description string

                Long command description string.
                """
            usage = '[options]'
            cmds = {'subcmd|sub-command': TestSubOptions}
            opts = [
                Opt('alpha', 'a', 'alpha help string', store=True),
                Opt('bravo',
                    'b',
                    'bravo help string',
                    store=int,
                    metavar='INT'),
                Opt('charlie', '', 'charlie help string', store=True),
                Opt('delta', '', 'delta help string', store=str)
            ]
コード例 #6
0
        class TestOptions1(Options):
            opts = [
                Opt('alpha', 'a', store=True),
                Opt('bravo', 'b', store=True),
                Opt('charlie', 'c', store=self.opt_c),
                Opt('delta', 'd', store={
                    '00': 1,
                    '01': 2,
                    '10': 3,
                    '11': 4
                }),
                Opt('echo', 'e', store=int),
                Opt('fox-trot', 'f', handler='fox_trot')
            ]

            def fox_trot(self_, arg):
                try:
                    self_['fox-trot'].append(arg)
                except:
                    self_['fox-trot'] = [arg]

            def parse_args(self_, *args):
                self.parse_args(*args)
コード例 #7
0
 class TestOptions(BaseOptions):
     opts = [
         Opt('charlie', 'c', store=True),
         Opt('delta', 'd', store=str)
     ]
コード例 #8
0
 class BaseOptions(Options):
     opts = [
         Opt('alpha', 'a', store=True),
         Opt('bravo', 'b', store=int)
     ]
コード例 #9
0
 class SubSubOptions1(Options):
     opts = [
         Opt('echo', 'e', store=str),
         Opt('fox-trot', 'f', store=True)
     ]