freckelize_cli.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:freckles 作者: makkus 项目源码 文件源码
def __init__(self, config, **kwargs):
        """Base class to provide a command-based (similar to e.g. git) cli for freckles.

        This class parses the folders in the paths provided by the config
        element for so-called 'freckle adapters'. A freckle adapter is a
        collection of files that describe commandline-arguments and tasks lists
        to execute on a folder (more information: XXX)

        Args:
          config (FrecklesConfig): the config wrapper object
          kwargs (dict): additional arguments that are forwarded to the partent click.MultiCommand constructor

        """

        click.MultiCommand.__init__(self, "freckles", result_callback=assemble_freckle_run, invoke_without_command=True,
                                    **kwargs)

        use_repo_option = click.Option(param_decls=["--use-repo", "-r"], required=False, multiple=True, help="extra context repos to use", is_eager=True, callback=download_extra_repos)
        output_option = click.Option(param_decls=["--output", "-o"], required=False, default="default",
                                     metavar="FORMAT", type=click.Choice(SUPPORTED_OUTPUT_FORMATS), is_eager=True,
                                     help="format of the output")
        no_run_option = click.Option(param_decls=["--no-run"],
                                     help='don\'t execute frecklecute, only prepare environment and print task list',
                                     type=bool, is_flag=True, default=False, required=False)
        version_option = click.Option(param_decls=["--version"], help='prints the version of freckles', type=bool,
                                      is_flag=True, is_eager=True, expose_value=False, callback=print_version)


        self.params = get_freckles_option_set()
        self.params.extend([ use_repo_option, output_option,  no_run_option, version_option])
        self.config = config

        self.profile_repo = ProfileRepo(self.config)

        # self.command_names.append(BREAK_COMMAND_NAME)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号