Beispiel #1
0
 def construct_parser(self):
     usage = "%s [arguments] <subcommand> [options]"  % self.command
     epilog = ["", cli.commands_description(), "",
               "shortcuts:",
               "  %(command)s <compiler>  Execute a compiler command", 
               "                  - Example: %(command)s gcc *.c -o a.out",
               "                  - Alias for '%(command)s build <compiler>'",
               "  %(command)s <program>   Gather data from a program",
               "                  - Example: %(command)s ./a.out",
               "                  - Alias for '%(command)s trial create <program>'",
               "  %(command)s show        Show data from the most recent trial",
               "                  - An alias for '%(command)s trial show'",
               "",
               "See '%(command)s help <subcommand>' for more information on <subcommand>."]
     parser = arguments.get_parser(prog=self.command,
                                   usage=usage,
                                   description=self.summary,
                                   epilog='\n'.join(epilog) % {'command': self.command})
     parser.add_argument('command',
                         help="See subcommand descriptions below",
                         metavar='<subcommand>')
     parser.add_argument('options',
                         help="Options to be passed to <subcommand>",
                         metavar='[options]',
                         nargs=arguments.REMAINDER)
     parser.add_argument('-v', '--verbose',
                         help="Set stdout logging level to DEBUG",
                         metavar='',
                         const='DEBUG',
                         default='INFO',
                         action='store_const')
     return parser
Beispiel #2
0
 def construct_parser(self):
     usage = "%s <subcommand> [arguments]" % self.command
     epilog = ['', cli.commands_description(self.module_name), '',
               "See '%s <subcommand> --help' for more information on <subcommand>." % self.command]
     parser = arguments.get_parser(prog=self.command, usage=usage, 
                                   description=self.summary, epilog='\n'.join(epilog))
     parser.add_argument('subcommand', 
                         help="See 'subcommands' below",
                         metavar='<subcommand>')
     parser.add_argument('options', 
                         help="Arguments to be passed to <subcommand>",
                         metavar='[arguments]',
                         nargs=arguments.REMAINDER)
     return parser