Debian Codegraph @

powa-collector.py

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/env python
2
3 import getopt
4 import os
5 import sys
6 from powa_collector import PowaCollector, getVersion
7
8
9 def usage(rc):
10 """Show tool usage
11 """
12 print("""Usage:
13 %s [ -? | --help ] [ -V | --version ]
14
15 -? | --help Show this message and exits
16 -v | --version Report powa-collector version and exits
17
18 See https://powa.readthedocs.io/en/latest/powa-collector/ for
19 more information about this tool.
20 """ % os.path.basename(__file__))
21
22 sys.exit(rc)
23
24
25 def main():
26 """Instantiates and starts a PowaCollector object
27 """
28 try:
29 opts, args = getopt.getopt(sys.argv[1:], "?V", ["help", "version"])
30 except getopt.GetoptError as e:
31 print(str(e))
32 usage(1)
33
34 for o, a in opts:
35 if o in ("-?", "--help"):
36 usage(0)
37 elif o in ("-V", "--version"):
38 print("%s version %s" % (os.path.basename(__file__), getVersion()))
39 sys.exit(0)
40 else:
41 assert False, "unhandled option"
42
43 app = PowaCollector()
44 app.main()
45
46
47 if (__name__ == "__main__"):
48 main()