From d8b0a159b8c1b89987cf2f9a108f5f70443fc28c Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Fri, 7 Oct 2022 13:59:37 +0100 Subject: [PATCH] added timurr WIP --- alurrm/src/timurr.nim | 31 +++++++++++++++++++++++++++++++ alurrm/timurr.nimble | 14 ++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 alurrm/src/timurr.nim create mode 100644 alurrm/timurr.nimble diff --git a/alurrm/src/timurr.nim b/alurrm/src/timurr.nim new file mode 100644 index 0000000..46811f4 --- /dev/null +++ b/alurrm/src/timurr.nim @@ -0,0 +1,31 @@ +import ../../globurrl +import argparse + +const DURATION_FMT="HH:mm:ss" + +var parser = newParser: + flag "-s", "--show", help="Show current timers" + flag "-a", "--add", help="Add a new timer, requires -d,--duration" + option "-d", "--duration", help="Duration in HH:mm:ss format", default=some("") + +proc show_timurr() = + echo "Hello" + +when isMainModule: + echo("This is still a work in progress") + try: + var opts = parser.parse() + if opts.show: + show_timurr() + elif opts.add: + if opts.duration != "": + echo "hi" + else: + stderr.writeLine "Cannot add (-a) without durations (-d)" + except ShortCircuit as e: + if e.flag == "argparse_help": + echo parser.help + quit(1) + except UsageError: + stderr.writeLine getCurrentExceptionMsg() + quit(1) diff --git a/alurrm/timurr.nimble b/alurrm/timurr.nimble new file mode 100644 index 0000000..b65d95a --- /dev/null +++ b/alurrm/timurr.nimble @@ -0,0 +1,14 @@ +# Package + +version = "0.1.0" +author = "Paul Wilde" +description = "A timer/alarm tool" +license = "GPL-3.0-or-later" +srcDir = "src" +bin = @["timurr"] + + +# Dependencies + +requires "nim >= 1.6.6" +requires "argparse"