diff --git a/src/dispatcher.nim b/src/dispatcher.nim index d37c696..c0190fc 100644 --- a/src/dispatcher.nim +++ b/src/dispatcher.nim @@ -16,6 +16,7 @@ import util/screenshurrt import util/calculaturr import util/brightnurrs import util/tideurrl +import util/wallpapurr proc dispatch*(cfg: Config) = case cfg.run @@ -51,5 +52,7 @@ proc dispatch*(cfg: Config) = brightnurrs.go() of Tideurrl: tideurrl.go() + of Wallpapurr: + wallpapurr.go() else: echo "No valid run command given" diff --git a/src/model/tool.nim b/src/model/tool.nim index 9c790bf..78a797f 100644 --- a/src/model/tool.nim +++ b/src/model/tool.nim @@ -17,4 +17,5 @@ type Screenshurrt, Calculaturr, Brightnurrs, - Tideurrl + Tideurrl, + Wallpapurr diff --git a/src/parser.nim b/src/parser.nim index b77cd27..6b4ef87 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -53,6 +53,8 @@ proc parseArgs*() = myConfig.run = Brightnurrs of "tideurrl", "tides": myConfig.run = Tideurrl + of "wallpapurr", "wallpaper": + myConfig.run = Wallpapurr else: echo p.help quit(1) @@ -180,3 +182,23 @@ proc parseTideurrlArgs*(): TideList = stderr.writeLine getCurrentExceptionMsg() quit(1) return t + +proc parseWallpapurrArgs*(): string = + var query = "devon coast" + let params = commandLineParams() + var p = newParser: + help("Args for wallpapurr") + arg("wallpapurr",help="can only ever be 'wallpapurr' as you won't have gotten this far otherwise") + option("-q","--query",help="query name") + try: + var opts = p.parse(params) + if opts.query != "": + query = opts.query + except ShortCircuit as err: + if err.flag == "argparse_help": + echo err.help + quit(1) + except UsageError: + stderr.writeLine getCurrentExceptionMsg() + quit(1) + return query diff --git a/src/util/wallpapurr.nim b/src/util/wallpapurr.nim new file mode 100644 index 0000000..a3eaeec --- /dev/null +++ b/src/util/wallpapurr.nim @@ -0,0 +1,12 @@ +import ../common +import ../parser +import ../output + +proc getDesign(): Info = + var data = newInfo("Wallpapurr") + return data + +proc go*() = + var mytides = parseWallpapurrArgs() + echo mytides +