sub_command_core.sub_command module¶
class snnipets # -- coding: utf-8 -- from sub_commands import SubCommands from jsonica import errorout import argparse
- class Generate(SubCommands):
“”” generate command “”” VERSION = ‘0.0.1’
__aliases = [‘gen’, ‘g’] __help = ‘generate help’
- def __init__(self):
- super().__init__()
@property def command_names(self): return [self.command_name] + self.aliases @property def aliases(self): return self.__aliases @property def help(self): return self.__help
- def __run__(self, **kwargs):
- # each process brabrabra pass
- def make_argparse(self, subparser):
myparser = super().make_argparse(subparser) # write each subcommand arg processor here myparser.add_argument(‘-v’, ‘–version’,
action=’version’, version=’{} {}’.format(self.command_name, VERSION))