用于自动生成命令行界面的内容库 Python Fire

码农软件 · 软件分类 · 常用工具包 · 2019-08-13 20:29:50

软件介绍

Python Fire 是 Google 开源的一个可从任何 Python 代码自动生成命令行接口(CLI)的库。

  • Python Fire 是一种在 Python 中创建 CLI 的简单方法。

  • Python Fire 是开发和调试 Python 代码的有用工具。

  • Python Fire 帮助探索现有代码或将其他人的代码转换为CLI。

  • Python Fire 使 Bash 和 Python 之间的转换更为容易。

  • Python Fire 通过使用你需要导入和创建的模块和变量来设置 REPL,使得使用 Python REPL 更容易。

简易示例:

import fire

class Calculator(object):
  """A simple calculator class."""

  def double(self, number):
    return 2 * number

if __name__ == '__main__':
  fire.Fire(Calculator)

然后,你可以运行:

python calculator.py double 10  # 20
python calculator.py double --number=15  # 30

本文地址:https://codercto.com/soft/d/12302.html

Practical Vim, Second Edition

Practical Vim, Second Edition

Drew Neil / The Pragmatic Bookshelf / 2015-10-31 / USD 29.00

Vim is a fast and efficient text editor that will make you a faster and more efficient developer. It’s available on almost every OS, and if you master the techniques in this book, you’ll never need an......一起来看看 《Practical Vim, Second Edition》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

MD5 加密
MD5 加密

MD5 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具