|
|
@ -9,6 +9,7 @@ import (
|
|
|
|
"log"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -16,14 +17,12 @@ import (
|
|
|
|
// editNoteCmd represents the editNote command
|
|
|
|
// editNoteCmd represents the editNote command
|
|
|
|
var editNoteCmd = &cobra.Command{
|
|
|
|
var editNoteCmd = &cobra.Command{
|
|
|
|
Use: "note",
|
|
|
|
Use: "note",
|
|
|
|
|
|
|
|
Short: "Edit the specified note",
|
|
|
|
Args: cobra.ExactArgs(1),
|
|
|
|
Args: cobra.ExactArgs(1),
|
|
|
|
Short: "A brief description of your command",
|
|
|
|
Long: `
|
|
|
|
Long: `A longer description that spans multiple lines and likely contains examples
|
|
|
|
Opens a file with the contents of the note. Edit this file to edit the
|
|
|
|
and usage of using your command. For example:
|
|
|
|
note. Note that trailing spaces will be trimmed.
|
|
|
|
|
|
|
|
`,
|
|
|
|
Cobra is a CLI library for Go that empowers applications.
|
|
|
|
|
|
|
|
This application is a tool to generate the needed files
|
|
|
|
|
|
|
|
to quickly create a Cobra application.`,
|
|
|
|
|
|
|
|
PreRunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
PreRunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
id, err := strconv.Atoi(args[0])
|
|
|
|
id, err := strconv.Atoi(args[0])
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -57,7 +56,7 @@ to quickly create a Cobra application.`,
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
App.EditDiaryEntryNote(note.Id, string(new_content))
|
|
|
|
App.EditDiaryEntryNote(note.Id, strings.TrimSpace(string(new_content)))
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|