用于在函数和类中轻松定义脚本参数的装饰器和包装器。只是定义函数的参数。

ArgParseInator的Python项目详细描述


argparseinator

Argparseinator是一个愚蠢但有用的东西,它允许您轻松地添加 argparse的参数和选项直接在函数中指向脚本 以及使用一些装饰器的类。

安装

pip安装argparseinator

快速示例(sayciao.py模块)

"""
Say ciao script.
"""__version__="1.2.3"fromargparseinatorimportArgParseInator,arg@arg()defsayciao(name):"""
    I will say ciao.
    """print"Ciao",nameif__name__=='__main__':ArgParseInator().check_command()

呼叫:

$ python sayciao.py --help

将输出:

usage: sayciao.py [-h][-v] name

Say ciao script.

    I will say ciao.


positional arguments:
  name

optional arguments:
  -h, --help     show this help message and exit
  -v, --version  show program's version number and exit

呼叫:

$ python sayciao.py --version

将输出:

sayciao.py 1.2.3

呼叫:

$ python sayciao.py luca

将输出:

Ciao luca

文档

readthedocs

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Gradle生成部署jar文件   带有多线程写入和多线程读取的ConcurrentLinkedQueue的java并发问题#快速目录扫描   java添加标记会导致Android中出现NullPointerException   Gson库的输出toJson方法中存在java错误Json   此Java致命错误的swing解释(异常\访问\冲突)   java Hibernate多个异常   java如何设置targetCompatibility=1.8、sourceCompatibility=1.9或更高版本的IntelliJ/Gradle项目?   阅读运行应用程序的eval print loop Java 9 REPL   Java web start无法运行我的JAR文件   java无法在对话框片段中创建活动   java如何在netbeans中填充Jcombobox中的项   java Fat jar maven需求   java Casting应用程序上下文给出了一个不可转换的类型错误   java jComboBox getSelected项错误