mirror of
https://github.com/sern-handler/cli
synced 2026-06-28 02:32:20 +00:00
feat(go): start rewrite in go
This commit is contained in:
28
cmd/cli/root.go
Normal file
28
cmd/cli/root.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "sern",
|
||||
Short: "A powerful CLI tool for Sern.",
|
||||
Version: "0.1.0",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Sern CLI")
|
||||
},
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
rootCmd.Flags().BoolP("help", "h", false, "Help for the Sern CLI.")
|
||||
rootCmd.Flags().BoolP("version", "v", false, "The version of the Sern CLI.")
|
||||
rootCmd.SetVersionTemplate("Sern CLI - Version {{.Version}}\n")
|
||||
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user