cl_shell.py 839 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/python3
  2. from argparse import ArgumentParser
  3. from core import *
  4. def main():
  5. arg_parser = ArgumentParser("temperature_convertor")
  6. arg_parser.add_argument('start_t',
  7. type=int,
  8. help="Start temperature")
  9. arg_parser.add_argument('-t1', '--start-type',
  10. required=True, choices=['C', 'K', 'F'],
  11. help='Start temperature type')
  12. arg_parser.add_argument('-t2', '--finish-type',
  13. required=True, choices=['C', 'K', 'F'],
  14. help='Finish temperature type')
  15. arg = arg_parser.parse_args()
  16. convert = f"{arg.start_type}>{arg.finish_type}"
  17. finish_t = round(get_func[convert](arg.start_t), 2)
  18. print(finish_t)
  19. if __name__ == "__main__":
  20. main()