add test script
This commit is contained in:
parent
5541facfd8
commit
f74e156c72
1 changed files with 46 additions and 0 deletions
46
test.py
Executable file
46
test.py
Executable file
|
@ -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 <g>%s<.> = %s" %(option.name, option.value))
|
||||
|
||||
main.print(str(main.cfg.verbosee))
|
||||
main.print("<m>targets<.>: %s" %(main.targets))
|
Loading…
Add table
Add a link
Reference in a new issue