# -*- coding:utf-8 -*-import clickfrom cli.formatting import formatting_filesfrom cli.watermark import watermark@click.group()def cli():"""我的命令行工具:基于 Click 库"""pass@cli.command(help = "格式化文档")@click.option("--path", "-p",type = click.Path(exists = True),help = "存放待格式化文本的文件夹路径")def fmt(path):click.echo("fmt is called.")formatting_files(path)@cli.command(help = "批量添加水印")@click.option("--dir", "-d",required = True,type = click.Path(exists = True),help = "存放待添加水印的图片的文件夹")@click.option("--mark", "-m",required = True,type = click.Path(exists = True),help = "水印图片文件路径",)@click.option("--pos", "-p",default = "topleft",type = click.Choice(["topleft", "topright", "bottomleft", "bottomright", "center"],case_sensitive = False),help = "水印摆放位置")def marked(dir, mark, pos):click.echo("watermark is called.")watermark(dir = dir,watermark_path = mark,pos = pos)if __name__ == "__main__":cli()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。