cmd-zet/cmd/view.go
Oliver Davies 5a64827825 Update command descriptions
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
2025-09-30 00:48:16 +01:00

32 lines
511 B
Go

package cmd
import (
"fmt"
"os"
"strconv"
"github.com/spf13/cobra"
"code.oliverdavies.uk/opdavies/cmd-zet/internal/lib"
)
var viewCmd = &cobra.Command{
Use: "view",
Aliases: []string{"v"},
Short: "View a specific zettel",
Long: `zet view|v 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)
}
fmt.Println(lib.ViewZet(idInt))
},
}