Skip to content

Commit 24580d3

Browse files
committed
better default values in config file
1 parent 53d843c commit 24580d3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

dly.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,20 @@ func getConfiguration() (conf Configuration) {
214214
if err != nil {
215215
log.Fatal().Msgf("cannot create empty config file at %s for config file: %v", configFilePath, err)
216216
}
217-
_, err = f.WriteString("DailyNotesPath: \nFilenameFormat: 2006_01_02\n")
217+
// initialize content with defaults
218+
defaultValues := Configuration{
219+
DailyNotesPath: "YOU MUST SET THIS to your journal folder",
220+
FilenameFormat: "2006_01_02",
221+
AddTimestamp: true,
222+
AddHashtag: true,
223+
HashtagToAdd: "from-cli",
224+
}
225+
defaultValuesB, _ := yaml.Marshal(defaultValues)
226+
_, err = f.Write(defaultValuesB)
218227
if err != nil {
219228
log.Fatal().Msgf("cannot add line to config file at %s for config file: %v", configFilePath, err)
220229
}
221-
log.Info().Msgf("minimal config file created at %s, you need to edit it to at least add the path to daily notes", configFilePath)
230+
log.Info().Msgf("minimal config file created at %s, you MUST now edit it to at least set the path to daily notes", configFilePath)
222231
os.Exit(2)
223232
} else {
224233
log.Fatal().Msgf("cannot check for presence of the config file: %v", err)

0 commit comments

Comments
 (0)