命令行接口(Command Line Interface,简称CLI)
# -*- coding: utf-8 -*-
# @File : fire_CLI_demo.py
# @Date : 2018-06-03
import fire
class Person(object):
def hello(self, name="world"):
print("hell %s"% name)
if __name__ == '__main__':
fire.Fire(Person)
# 运行命令: python fire_CLI_demo.py hello
参考
- 【谷歌大脑出品】Python Fire: 一个可以自动生成命令行接口(CLI)的库
- 【Python】自动生成命令行工具 - fire 简介