over/test.py
Martinez ed947bf8e6 New features (closes #6):
- config file selection (---config PATH)
- dump state as executable command (---dump)
- over library desciption (---help)
- finished automatic --help view

Fixes
- callbacks are called after the application's state is determined (closes #9)
- many small fixes
2016-05-18 00:40:42 +02:00

41 lines
2.4 KiB
Python
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! /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.add_doc("Moar", ["When we launched Raspberry Pi Zero last November, its fair to say we were <W>blindsided<.> by the level of demand. We immediately sold every copy of MagPi issue 40 and every Zero in stock at our distributors; and every time a new batch of Zeros came through from the factory theyd sell out in minutes. To complicate matters, Zero then had to compete for factory space with Raspberry Pi 3, which was ramping for launch at the end of February.", "To connect the camera to the Zero, we offer a custom six-inch adapter cable. This converts from the fine-pitch connector format to the coarser pitch used by the camera board. Liz has a great picture of Mooncake, the official Raspberry Pi cat, attempting to eat the camera cable. She wont let me use it in this post so that you arent distracted from the pictures of the new Zero itself. Ive a feeling shell be tweeting it later today."])
main.setup()