python
구글에서 만든 파이썬 CLI 예시
'김용환'
2019. 4. 23. 19:56
https://github.com/google/python-fire
import fire
class Calculator(object):
“”"A simple calculator class.“”"
def double(self, number):
return 2 * number
def hello(self, name):
return “hello ” + name + “!”
if __name__ == ‘__main__‘:
fire.Fire(Calculator)
$ python calculator.py double --number=15
30
$ python calculator.py double 10
20
$ python test.py hello --name=“sam”
hello sam!