
- over.app.ConfigFile can read, create and amend config files - fix over.cmd.format_invocation - add join to over.text.paragraph
46 lines
1.7 KiB
Python
Executable file
46 lines
1.7 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 noop(*args):
|
|
return args
|
|
|
|
def int4(*args):
|
|
return [int(x) for x in args]
|
|
|
|
if __name__ == "__main__":
|
|
main = over.app.Main("new-over-test", version.str, "LICENSE", features={"config_file": True})
|
|
# name, description, callback, default=Option_sources.none, count=0, overwrite=True, abbr=None, in_cfg_file=True, show_in_help=True
|
|
main.add_option("boolean-single", "ISO 8601 date for a new transfer (valid with +EHMU), defaults to current date. It's also used for relative times with --analysis-timeframe. You can use a day-count relative to today here.", over.callback.boolean, [False], abbr="1")
|
|
main.add_option("boolean-triple", "", over.callback.booleans, [False, False, False], abbr="3", count=3)
|
|
main.add_option("str-single", "", str, ["kek"], abbr="s", count=1)
|
|
main.add_option("str-quad", "", noop, ["ze", "kek", "is", "bek"], abbr="4", count=4)
|
|
main.add_option("int-quad", "", int4, [45, 72, 97, 18], abbr="i", count=4)
|
|
main.add_option("int-quad-multi", "", int4, [45, 72, 97, 18], abbr="I", count=4, overwrite=False)
|
|
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))
|