Example #1
0
    def __init__(self, argv):
        """Pass the sys.argv parameter list to your __init__ method."""

        # you must first inherit the super class __init__ method.
        super(Hello, self).__init__(argv)

        # add your Arguments
        self.user = CLI.List("user names")
        self.computer = CLI.Switch("name of the computer",
                                   "Lisa",
                                   "c",
                                   name="computer-name")
        self.message = CLI.Switch("the greeting", "how are you?", "m")
        self.verbose = CLI.Flag("show output", False, "v")
        self.version = CLI.Terminator("show version information",
                                      "hello.py (1.0.1)", "V")
        self.copyright = CLI.Terminator(
            "show copyright information", "hello.py (1.0.1)\n"
            "Copyright (c) Geoffrey Lentner 2015. All rights reserved.\n"
            "GNU General Public License (v3.0).\n"
            "This is free software; see the source for copyright conditions. There is NO\n"
            "waranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",
            "C")

        # if the `info` member is defined, it will be displayed at the end of a call to
        # -h | --help
        self.info = (""
                     "Report bugs to: [email protected]\n"
                     "home page: <http://github.com/glentner/CLI-Python>")