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!

 

 

Posted by 김용환 '김용환'