cmd-zet/cmd/edit.go
Oliver Davies 125aa05e0d Add edit command to edit a zettel
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
2025-09-24 19:36:06 +01:00

36 lines
769 B
Go

package cmd
import (
"fmt"
"os"
"strconv"
"github.com/spf13/cobra"
"code.oliverdavies.uk/opdavies/cmd-zet/internal/lib"
)
var editCmd = &cobra.Command{
Use: "edit",
Aliases: []string{"e"},
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
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.`,
Run: func(cmd *cobra.Command, args []string) {
if len(args) < 1 {
fmt.Println("Error: No id provided")
os.Exit(1)
}
idInt, err := strconv.Atoi(args[0])
if err != nil {
os.Exit(1)
}
lib.EditZet(idInt)
},
}