appcon.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 """
4 usage: %(progname)s
5  install [taskid]
6  remove [taskid]
7  list
8 """
9 
10 
11 import os, sys, string, time, getopt
12 
13 PKG = 'webui' # this package name
14 import roslib; roslib.load_manifest(PKG)
15 
16 from webui import webutil
17 
18 import roslib.scriptutil
19 
20 from pyclearsilver.log import *
21 
22 import db_webui
23 
24 def test():
25  pass
26 
27 def usage(progname):
28  print __doc__ % vars()
29 
30 def main(argv, stdout, environ):
31  progname = argv[0]
32  optlist, args = getopt.getopt(argv[1:], "", ["help", "test", "debug"])
33 
34  testflag = 0
35  if len(args) == 0:
36  usage(progname)
37  return
38  for (field, val) in optlist:
39  if field == "--help":
40  usage(progname)
41  return
42  elif field == "--debug":
43  debugfull()
44  elif field == "--test":
45  testflag = 1
46 
47  if testflag:
48  test()
49  return
50 
51  db = db_webui.initSchema()
52 
53  cmd = args[0]
54  args = args[1:]
55 
56  if cmd == "list":
57  apps = db.apps.listApps()
58  for app in apps:
59  print app.taskid
60  elif cmd == "install":
61  for taskid in args:
62  db.apps.installAppWithPath(taskid)
63  elif cmd == "remove":
64  for taskid in args:
65  db.apps.removeApp(taskid)
66  elif cmd == "listall":
67  apps = webutil.list_apps()
68  for app in apps:
69  print app
70 
71 if __name__ == "__main__":
72  main(sys.argv, sys.stdout, os.environ)
def main(argv, stdout, environ)
Definition: appcon.py:30
def usage(progname)
Definition: appcon.py:27


webui
Author(s): Scott Hassan
autogenerated on Mon Jun 10 2019 15:51:24