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))
class sub_command_core.sub_command.SubCommands[source]

Bases: object

jsonica subcommands abstract class concretes class rules: - class名を全小文字化したものがsubcommand名になる - git commandのように、entryをまるごと渡すことはしない、少なくともwrapperはpythonで書く

aliases
command_name
command_names
help
make_argparse(subparser)[source]

個別optionを登録したargparseをsubparseにして返す

classmethod regist_command(exchanger)[source]

subcommand 登録 dont call from exchanger.__init__()