#!/usr/bin/python
# PYTHON_ARGCOMPLETE_OK

import openaps
from openaps import cli
from oacids import schedules
import sys

class ScheduleApp (cli.ConfigApp):
  """ openaps-schedules - manage schedules

  """
  name = 'schedules'
  def configure_parser (self, parser):
    self.read_config( )
    self.configure_schedules( )
    # available = devices.get_device_map(self.config)

  def configure_schedules (self):
    self.commands = schedules.ScheduleManagement(parent=self)
    self.commands.configure_commands(self.parser)

  def prolog (self):
    super(ScheduleApp, self).prolog( )

  def epilog (self):
    super(ScheduleApp, self).epilog( )

  def run (self, args):
    # print self.commands
    app = self.commands.selected(args)
    output = app(args, self)

if __name__ == '__main__':

    app = ScheduleApp(None)
    app( )
