diff options
| author | historia <gravel.justness270@slmail.me> | 2024-08-06 20:08:43 -0400 |
|---|---|---|
| committer | historia <gravel.justness270@slmail.me> | 2024-08-06 20:08:43 -0400 |
| commit | 1320375ebc0e87956807c0c543abe9f9a9f1dd6e (patch) | |
| tree | c5bb8db27be90ffa4c7b321d8fd9a907ad47e6fb /src | |
| parent | 0139b8b7896f6fcc89b3e2481d315e96af82ec4a (diff) | |
| download | soon-1320375ebc0e87956807c0c543abe9f9a9f1dd6e.tar.gz | |
Config added. Name change to Soon.
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() |
