scripts/weatherpub.py
def get_options(parser):
   '''
   read command line options to configure program behavior.
   '''
   # station services
   # publication services
   pub_g = optparse.OptionGroup( parser, "Publication Services",
         '''One or more publication service must be specified to enable upload
         of weather data.''', )
   pub_g.add_option('-w', '--wundergound', nargs=2, type='string', dest='wug',
         help='Weather Underground service; WUG=[SID(station ID), PASSWORD]')
   pub_g.add_option('-p', '--pws', nargs=2, type='string', dest='pws',
         help='PWS service; PWS=[SID(station ID), PASSWORD]')
   pub_g.add_option('-f', '--file', nargs=1, type='string', dest='file',
         help='Local file; FILE=[FILE_NAME]')
   parser.add_option_group(pub_g)

   parser.add_option('-d', '--debug', dest='debug', action="store_true",
         default=False, help='enable verbose debug logging')
   parser.add_option('-q', '--quiet', dest='quiet', action="store_true",
         default=False, help='disable all console logging')
   parser.add_option('-t', '--tty', dest='tty', default='/dev/ttyS0',
         help='set serial port device [/dev/ttyS0]')
   parser.add_option('-n', '--interval', dest='interval', default=60,
         type='int', help='polling/update interval in seconds [60]')
   return parser.parse_args()
def get_options(parser):
   '''
   read command line options to configure program behavior.
   '''
   # station services
   # publication services
   pub_g = optparse.OptionGroup( parser, "Publication Services",
         '''One or more publication service must be specified to enable upload
         of weather data.''', )
   pub_g.add_option('-w', '--wundergound', nargs=2, type='string', dest='wug',
         help='Weather Underground service; WUG=[SID(station ID), PASSWORD]')
   pub_g.add_option('-p', '--pws', nargs=2, type='string', dest='pws',
         help='PWS service; PWS=[SID(station ID), PASSWORD]')
   pub_g.add_option('-f', '--file', nargs=1, type='string', dest='file',
         help='Local file; FILE=[FILE_NAME]')
   parser.add_option_group(pub_g)

   parser.add_option('-d', '--debug', dest='debug', action="store_true",
         default=False, help='enable verbose debug logging')
   parser.add_option('-q', '--quiet', dest='quiet', action="store_true",
         default=False, help='disable all console logging')
   parser.add_option('-t', '--tty', dest='tty', default='/dev/ttyS0',
         help='set serial port device [/dev/ttyS0]')
   parser.add_option('-n', '--interval', dest='interval', default=60,
         type='int', help='polling/update interval in seconds [60]')
   return parser.parse_args()
read command line options to configure program behavior.