Skip to content

Commit

Permalink
feat: Add backbone (cobra cmd) of slut & add version command
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejsika committed Jul 29, 2021
1 parent 5fa5a4a commit 75ed733
Show file tree
Hide file tree
Showing 5 changed files with 614 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/sikalabs/slut/cmd/version"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "slut",
Short: "SikaLabs Utils",
}

func Execute() {
cobra.CheckErr(rootCmd.Execute())
}

func init() {
rootCmd.AddCommand(version.VersionCmd)
}
18 changes: 18 additions & 0 deletions cmd/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package version

import (
"fmt"

"github.com/spf13/cobra"
)

var version string = "v0.1.0-dev"

var VersionCmd = &cobra.Command{
Use: "version",
Short: "Prints version",
Args: cobra.NoArgs,
Run: func(c *cobra.Command, args []string) {
fmt.Printf("%s\n", version)
},
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/sikalabs/slut

go 1.16

require github.com/spf13/cobra v1.2.1
Loading

0 comments on commit 75ed733

Please sign in to comment.