cmd-zet/cmd/edit.go

32 lines
497 B
Go
Raw Normal View History

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: "Edit a specific zettel",
Long: `zet edit|e ID`,
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)
},
}