45 lines
1.4 KiB
Python
Executable file
45 lines
1.4 KiB
Python
Executable file
#! /usr/bin/env python3
|
|
# encoding: utf-8
|
|
|
|
# library imports
|
|
import over
|
|
|
|
# local imports
|
|
import version
|
|
|
|
# --------------------------------------------------
|
|
# Exceptions
|
|
|
|
class ConfigurationError(Exception):
|
|
pass
|
|
|
|
# --------------------------------------------------
|
|
# Functions
|
|
|
|
# --------------------------------------------------
|
|
# Classes
|
|
|
|
# --------------------------------------------------
|
|
|
|
def tag_callback(tag, value):
|
|
return "%s: %s" %(tag, value)
|
|
|
|
def tri_callback(a, b, c):
|
|
return "%s, %s and %s" %(a, b, c)
|
|
|
|
if __name__ == "__main__":
|
|
main = over.app.Main("Over App Test", version.str, "LICENSE")
|
|
# name, description, callback, default=Option_sources.none, count=0, overwrite=True, abbr=None, in_cfg_file=True, show_in_help=True
|
|
main.add_option("armed", "Description.", bool, True, abbr="A")
|
|
main.add_option("verbose", "Description.", bool, True, abbr="v")
|
|
main.add_option("read", "Description.", str, ["test"], count=1, overwrite=False, abbr="R")
|
|
main.add_option("tag", "Description.", tag_callback, [], count=2, overwrite=False, abbr="t")
|
|
main.add_option("tristate", "Description.", tri_callback, [], count=3, overwrite=True)
|
|
main.add_doc("Description", ["What it does.", "Another paragraph."])
|
|
main.parse()
|
|
|
|
for option in main.options.values():
|
|
if option.name not in ["help", "-help"]:
|
|
main.print("option <g>%s<.> = %s" %(option.name, option.value))
|
|
|
|
main.print("<m>targets<.>: %s" %(main.targets))
|