Add view
command
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
parent
f9a05ab5d9
commit
0a6e2b075c
4 changed files with 68 additions and 5 deletions
39
cmd/view.go
Normal file
39
cmd/view.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"code.oliverdavies.uk/opdavies/cmd-zet/internal/lib"
|
||||
"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)
|
||||
}
|
||||
|
||||
zetDir := "/home/opdavies/Documents/zet"
|
||||
|
||||
fmt.Println(lib.ViewZet(zetDir, idInt))
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue