小提示库
tinyprompt的Python项目详细描述
轻触
一个很小的库,用于很好的、方便的提示,主要用于操作脚本。
本自述包含所有文档。
使用量
pip install tinyprompt
使用tinyprompt.skiptable用是/skip/quit包装脚本步骤
迅速。这对于简单的脚本操作非常有用,其中
-是的是正常情况
-跳过可用于在失败或中止后恢复
-退出用于在遇到问题时中止
importtinyprompt# note: tinyprompt.skippable passes arguments through verbatim, but it's# not guaranteed to return a meaningful result# `quit` does a sys.exit(1) and `skip` makes it return `None`@tinyprompt.skippable('skippable script step')defmy_func():"""
Do some things, this docstring will show up as a command description
when the script is run.
The "skippable script step" arg will be uppercased and used as the step
name.
"""print('this skippable step')@tinyprompt.skippable('other skippable script step',color=False)defmy_func2():"""another func"""print('hi')defotherfunc():# yes, it's on purposetinyprompt.color_print('red string',tinyprompt.RED)tinyprompt.color_print('yellow string',tinyprompt.BLUE)tinyprompt.color_print('green string',tinyprompt.GRAY)tinyprompt.color_print('blue string',tinyprompt.GREEN)tinyprompt.color_print('gray string',tinyprompt.YELLOW)defmain():my_func()# skippablemy_func2()# skippableotherfunc()# not skippable, but not reached on quitif__name__=='__main__':main()
贡献
- 所有代码必须通过测试
- 所有代码都用黑色和isort 自动格式化
- 无论何时发现错误,请尝试编写测试
- 把你的档案清理干净。重新定位以避免合并冲突和挤压修复提交