def add_args():
    """Adds commandline arguments and formatted Help"""
    parser = argparse.ArgumentParser()

    parser.add_argument('-host', action='store', dest='host', default='127.0.0.1', help='DEFAULT "127.0.0.1"')
    parser.add_argument('-port', action='store', dest='port', default='2947', help='DEFAULT 2947', type=int)
    parser.add_argument('-json', dest='gpsd_protocol', const='json', action='store_const', default='json', help='DEFAULT JSON objects */')
    parser.add_argument('-device', dest='devicepath', action='store', help='alternate devicepath e.g.,"-device /dev/ttyUSB4"')
    # Infrequently used options
    parser.add_argument('-nmea', dest='gpsd_protocol', const='nmea', action='store_const', help='*/ output in NMEA */')
    # parser.add_argument('-rare', dest='gpsd_protocol', const='rare', action='store_const', help='*/ output of packets in hex */')
    # parser.add_argument('-raw', dest='gpsd_protocol', const='raw', action='store_const', help='*/ output of raw packets */')
    # parser.add_argument('-scaled', dest='gpsd_protocol', const='scaled', action='store_const', help='*/ scale output to floats */')
    # parser.add_argument('-timing', dest='gpsd_protocol', const='timing', action='store_const', help='*/ timing information */')
    # parser.add_argument('-split24', dest='gpsd_protocol', const='split24', action='store_const', help='*/ split AIS Type 24s */')
    # parser.add_argument('-pps', dest='gpsd_protocol', const='pps', action='store_const', help='*/ enable PPS JSON */')
    parser.add_argument('-v', '--version', action='version', version='Version: {}'.format(__version__))
    cli_args = parser.parse_args()
    return cli_args
def add_args ( ) : parser = argparse . ArgumentParser ( ) parser . add_argument ( '-host' , action = 'store' , dest = 'host' , default = '127.0.0.1' , help = 'DEFAULT "127.0.0.1"' ) parser . add_argument ( '-port' , action = 'store' , dest = 'port' , default = '2947' , help = 'DEFAULT 2947' , type = int ) parser . add_argument ( '-json' , dest = 'gpsd_protocol' , const = 'json' , action = 'store_const' , default = 'json' , help = 'DEFAULT JSON objects */' ) parser . add_argument ( '-device' , dest = 'devicepath' , action = 'store' , help = 'alternate devicepath e.g.,"-device /dev/ttyUSB4"' ) parser . add_argument ( '-nmea' , dest = 'gpsd_protocol' , const = 'nmea' , action = 'store_const' , help = '*/ output in NMEA */' ) parser . add_argument ( '-v' , '--version' , action = 'version' , version = 'Version: {}' . format ( __version__ ) ) cli_args = parser . parse_args ( ) return cli_args
Adds commandline arguments and formatted Help