hatch

Open or close the hatch

usage: hatch: [-h, --help] status

-h , --help

show this help message and exit

status

open,close. If omitted, returns status

#! @KPYTHON@

from KCWI import Calibration
import argparse
import sys

# Parsing arguments
description = "Open or close the hatch"
parser = argparse.ArgumentParser(description=description)
parser.add_argument('status',nargs="?",default=None, help='open,close. If omitted, returns status', choices=["open","close","OPEN","CLOSE"])

if __name__ == '__main__':

   args = parser.parse_args()

   status = Calibration.hatch(status=args.status)
   if int(status) == 1:
      sys.stdout.write("Open"+"\n")
   if int(status) == 0:
      sys.stdout.write("Closed"+"\n")