From f74e156c7218c43837bbf1ec0d16e2ec90a41c54 Mon Sep 17 00:00:00 2001 From: Martinez Date: Mon, 16 May 2016 10:50:44 +0200 Subject: [PATCH] add test script --- test.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 test.py diff --git a/test.py b/test.py new file mode 100755 index 0000000..6b21855 --- /dev/null +++ b/test.py @@ -0,0 +1,46 @@ +#! /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", use_cfg_file=False) + # 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 %s<.> = %s" %(option.name, option.value)) + + main.print(str(main.cfg.verbosee)) + main.print("targets<.>: %s" %(main.targets))