From 8d67db0759fcca559abec79b3c856864bcc1bacf Mon Sep 17 00:00:00 2001 From: Jon Alfaro Date: Sat, 7 Jun 2025 12:00:37 +1000 Subject: [PATCH] feat: add config option create_empty to create notes with no content --- config.go | 2 ++ main.go | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index f715302..9b48d03 100644 --- a/config.go +++ b/config.go @@ -33,6 +33,7 @@ type Config struct { Light string `yaml:"light"` Dark string `yaml:"dark"` } `yaml:"theme"` + CreateEmpty bool `yaml:"create_empty"` } type Dimensions struct { @@ -102,6 +103,7 @@ func DefaultConfig() *Config { Light: "default", Dark: "default", }, + CreateEmpty: false, } } diff --git a/main.go b/main.go index 3b91197..4ceca56 100644 --- a/main.go +++ b/main.go @@ -189,9 +189,13 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { timestamp := time.Now().Format("2006-01-02-150405") filename := filepath.Join(currentDir, fmt.Sprintf("note-%s.md", timestamp)) + content := "" - content := fmt.Sprintf("# New Note\n\nCreated: %s\n", - time.Now().Format("2006-01-02 15:04:05")) + // If CreateEmpty is falsey, create a default content + if !m.config.CreateEmpty { + content = fmt.Sprintf("# New Note\n\nCreated: %s\n", + time.Now().Format("2006-01-02 15:04:05")) + } if err := os.WriteFile(filename, []byte(content), 0644); err == nil { m.updateNotes()