diff --git a/cmd/end.go b/cmd/end.go index 0c33826..3bd45bc 100644 --- a/cmd/end.go +++ b/cmd/end.go @@ -1,6 +1,3 @@ -/* -Copyright © 2023 NAME HERE -*/ package cmd import ( diff --git a/cmd/init.go b/cmd/init.go index fe3488e..48b4d20 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -1,6 +1,3 @@ -/* -Copyright © 2023 NAME HERE -*/ package cmd import ( diff --git a/cmd/note.go b/cmd/note.go index b764787..6ee08c9 100644 --- a/cmd/note.go +++ b/cmd/note.go @@ -1,6 +1,3 @@ -/* -Copyright © 2023 NAME HERE -*/ package cmd import ( diff --git a/cmd/report.go b/cmd/report.go index 8244208..0a139f3 100644 --- a/cmd/report.go +++ b/cmd/report.go @@ -1,6 +1,3 @@ -/* -Copyright © 2023 NAME HERE -*/ package cmd import ( diff --git a/cmd/report_week.go b/cmd/report_week.go index c79b6bc..ba52986 100644 --- a/cmd/report_week.go +++ b/cmd/report_week.go @@ -1,6 +1,3 @@ -/* -Copyright © 2023 NAME HERE -*/ package cmd import ( diff --git a/cmd/root.go b/cmd/root.go index b645512..6e2155c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,24 +1,3 @@ -/* -Copyright © 2023 Robson Cruz - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ package cmd import ( diff --git a/cmd/start.go b/cmd/start.go index 79956f9..8d60bd9 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -1,6 +1,3 @@ -/* -Copyright © 2023 NAME HERE -*/ package cmd import ( diff --git a/internal/ioutils.go b/internal/ioutils.go index 279ac37..d0bf6c0 100644 --- a/internal/ioutils.go +++ b/internal/ioutils.go @@ -6,6 +6,23 @@ import ( "os" ) +// SaveEntries encodes the given journal entries into JSON format and writes +// them to a file with the specified filename. +// +// The function will return an error if the encoding process fails or if the +// file cannot be created or written to. +// +// The function takes two parameters: +// - journalEntries: a slice of JournalEntry objects to be saved. +// - filename: a string representing the name of the file to write to. +// +// Example: +// +// entries := []JournalEntry{...} +// err := SaveEntries(entries, "journal.json") +// if err != nil { +// log.Fatal(err) +// } func SaveEntries(jounalEntries []JournalEntry, filename string) error { data, err := json.Marshal(jounalEntries) if err != nil { diff --git a/main.go b/main.go index 237f789..d96fbeb 100644 --- a/main.go +++ b/main.go @@ -1,24 +1,3 @@ -/* -Copyright © 2023 Robson Cruz - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ package main import (