diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/soon.nim (renamed from src/then.nim) | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/then.nim b/src/soon.nim index 4f4199d..3040f84 100644 --- a/src/then.nim +++ b/src/soon.nim @@ -1,10 +1,10 @@ import std/[times, os, strutils, strbasics, strscans, sets, strtabs, tables], parseopt -import then/[conditions, config, typechecker] +import soon/[conditions, config, typechecker] const VERSION = "0.1" -const configDir = expandTilde("~/.config/then/") -const defaultConfigFile = configDir & "then.toml" -const defaultCalendarFile = configDir & "calendar.then" +const configDir = expandTilde("~/.config/soon/") +const defaultConfigFile = configDir & "soon.toml" +const defaultCalendarFile = configDir & "calendar.soon" const MONTHS = DefaultLocale.MMM.toHashSet + DefaultLocale.MMMM.toHashSet const WEEKDAYS = DefaultLocale.ddd.toHashSet + DefaultLocale.dddd.toHashSet @@ -14,11 +14,11 @@ proc printHelp(badCmd: string) = echo badCmd & " is not a valid option\n" echo """ Usage: - then [options] [commands] + soon [options] [commands] OPTIONS -h, --help show list of CLI options - -v, --version show then version + -v, --version show soon version --future=DAYS set future --past=DAYS set past @@ -30,7 +30,7 @@ COMMANDS quit() proc printVersion() = - echo "then " & VERSION + echo "soon " & VERSION quit() # Splits a string on whitespace, but maintains whitespace in date groups @@ -110,16 +110,10 @@ proc printCalendar() = let curDay = now + i.days printEvents(cal, curDay, "ddd yyyy MMM dd") -proc main() = - var config = loadConfig() - echo config - var past: int = 1 - var future: int = 14 - var noArg: bool = true +proc parseArgs(config: StringTableRef): StringTableRef = for kind, key, val in getopt(): case kind of cmdLongOption, cmdShortOption: - noArg = false case key of "help", "h": printHelp("") @@ -130,6 +124,11 @@ proc main() = else: discard +proc main() = + var config = loadConfig() + config = parseArgs(config) + var noArg: bool = true + if noArg: printCalendar() |
