跳转到主要内容

异步命令行应用程序构建器。

项目描述

precept

CircleCI Documentation Status Coverage Status PyPI version LICENSE Downloads

异步应用程序框架。

安装

使用pip安装: $ pip install precept

用法

基本

from precept import Precept, Command, Argument

class MyCli(Precept):
    """
    The name of the application will be the spinal-case version of 
    the name of the class.
    
    Class docstring is added as cli description.
    """
    @Command(Argument('argument', type=str))
    async def my_command(self, argument):
        print(argument)

def cli():
    MyCli().start()

if __name__ == '__main__':
   cli()

本地测试

  • setup.py中将entry_points.console_script设置为my-cli = my_package.my_cli:cli
  • 本地安装:$ pip install -e .
  • 然后调用:$ my-cli my-command hello -> 打印 hello

完整文档

项目详细信息


下载文件

下载适合您的平台文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

precept-0.6.7.tar.gz (20.4 kB 查看哈希)

上传于

由...