aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/then.nim25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/then.nim b/src/then.nim
index cfd0b44..4f4199d 100644
--- a/src/then.nim
+++ b/src/then.nim
@@ -1,5 +1,5 @@
-import std/[times, os, strutils, strbasics, strscans, sets, tables], parseopt
-import then/[conditions,typechecker]
+import std/[times, os, strutils, strbasics, strscans, sets, strtabs, tables], parseopt
+import then/[conditions, config, typechecker]
const VERSION = "0.1"
const configDir = expandTilde("~/.config/then/")
@@ -9,25 +9,6 @@ const defaultCalendarFile = configDir & "calendar.then"
const MONTHS = DefaultLocale.MMM.toHashSet + DefaultLocale.MMMM.toHashSet
const WEEKDAYS = DefaultLocale.ddd.toHashSet + DefaultLocale.dddd.toHashSet
-# Creates a default configuration file if it doesn't exist
-proc createDefaultConfigFile() =
- if not fileExists(defaultConfigFile):
- if not dirExists(configDir):
- createDir(configDir)
- writeFile(defaultConfigFile, """
- [config]
- directory = "~/.config/then/"
- """)
-
-# Creates a default calendar file if it doesn't exist
-proc createDefaultCalendarFile() =
- if not fileExists(defaultCalendarFile):
- if not dirExists(configDir):
- createDir(configDir)
- writeFile(defaultCalendarFile, """
- # Add your events here
- """)
-
proc printHelp(badCmd: string) =
if badCmd != "":
echo badCmd & " is not a valid option\n"
@@ -130,6 +111,8 @@ proc printCalendar() =
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