wmtools/src/parser.nim

32 lines
785 B
Nim
Raw Normal View History

2023-11-22 21:19:37 +00:00
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")
2023-11-22 21:42:13 +00:00
arg("input",help="the tool to run, i.e. furrytime, pingclock, volurrme, etc.")
2023-11-22 21:19:37 +00:00
try:
var opts = p.parse(params)
case opts.input
of "furrytime", "fuzzytime", "time":
myConfig.run = FurryTime
of "pingclock", "pingclurrk", "ping":
myConfig.run = PingClock
2023-11-22 21:42:13 +00:00
of "batturry", "battery", "bat":
myConfig.run = Batturry
2023-11-22 21:19:37 +00:00
else:
echo p.help
quit(1)
except ShortCircuit as err:
if err.flag == "argparse_help":
echo err.help
quit(1)
except UsageError:
stderr.writeLine getCurrentExceptionMsg()
quit(1)