类似于click.path但返回pathlib路径的python click类型
click-pathlib的Python项目详细描述
Click Pathlib
pythonclick类型,类似于click.Path,但返回Pathlib.Path。
Installation
$ pip install click-pathlib
这支持Python3.5+。
Usage
使用click_pathlib.Path就像使用click.Path类型一样,您的函数将收到pathlib.Path。
importclickimportclick_pathlib@click.command('delete')@click.argument('existing_file',type=click_pathlib.Path(exists=True),)defdelete(existing_file):existing_file.unlink()