import os import argparse import common proc parseArgs*() = let params = commandLineParams() var p = newParser: help("WMTools : a set of tools to output option to your program of choice i.e. Rofi") arg("input",help="the tool to run, i.e. furrytime, pingclock, volurrme, etc.") arg("adjust", help="(up, down, mute) allows to send extra commands. i.e. when run with volurrme, allows to adjust the volume",default=some("None")) try: var opts = p.parse(params) case opts.input of "furrytime", "fuzzytime", "time": myConfig.run = FurryTime of "pingclock", "pingclurrk", "ping": myConfig.run = PingClock of "batturry", "battery", "bat": myConfig.run = Batturry of "volurrme", "volume", "vol": myConfig.run = Volurrme of "netwurrk", "network", "net": myConfig.run = Netwurrk else: echo p.help quit(1) case opts.adjust of "volup": myConfig.extra_args.add(VolUp) of "voldown": myConfig.extra_args.add(VolDown) of "mute","volmute": myConfig.extra_args.add(VolMute) except ShortCircuit as err: if err.flag == "argparse_help": echo err.help quit(1) except UsageError: stderr.writeLine getCurrentExceptionMsg() quit(1)