cmd-zet/cmd/view.go
Oliver Davies 2537b4db9e Refactor
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
2025-09-24 19:41:32 +01:00

37 lines
783 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: "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)
}
fmt.Println(lib.ViewZet(idInt))
},
}