Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestNewCmd(t *testing.T) {
defer os.RemoveAll(sb)

var wantError error
wantStdoutFilepath := filepath.Join(sb, "inbox", "20250713 "+tt.sanitisedTitle+".md")
wantStdoutFilepath := filepath.Join(sb, "inbox", "2025-07-13 "+tt.sanitisedTitle+".md")

newCmd.Flags().Set("no-open", "true")
gotStdout, _, gotError := captureOutput(newCmdFunction, newCmd, []string{tt.inputTitle})
Expand Down
8 changes: 4 additions & 4 deletions cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ func newCmdFunction(cmd *cobra.Command, args []string) error {
sanitisedTitle := internal.SanitiseTitle(title)

if dateFlag, _ := cmd.Flags().GetBool("no-date"); !dateFlag {
sanitisedTitle = config.Now().Format("20060102 ") + sanitisedTitle
sanitisedTitle = cfg.Today + " " + sanitisedTitle
}

noteExists, existingNoteFilepath := internal.CheckIfNoteExists(cfg.RootDir, sanitisedTitle+".md")

if !noteExists {
filepath = internal.ConstructNotePath(cfg.InboxDir, sanitisedTitle)
content := renderStdNoteContent(title)
content := renderStdNoteContent(title, cfg.Today)
internal.CreateNote(filepath, content)

fmt.Println(filepath)
Expand All @@ -53,6 +53,6 @@ var newCmd = &cobra.Command{
Args: cobra.MatchAll(cobra.ExactArgs(1)),
RunE: newCmdFunction}

func renderStdNoteContent(title string) string {
return fmt.Sprintf("---\ntitle: %s\n---\n", title)
func renderStdNoteContent(title string, date string) string {
return fmt.Sprintf("---\ntitle: %s\ndate: %s\n---\n", title, date)
}