add developer CLI tool with Cobra for app workflow
This commit is contained in:
47
portal/cmd/mosis/main.go
Normal file
47
portal/cmd/mosis/main.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/omixlab/mosis-portal/cmd/mosis/cmd"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "mosis",
|
||||
Short: "Mosis app development CLI",
|
||||
Long: "CLI tool for building, signing, and publishing Mosis apps",
|
||||
}
|
||||
|
||||
// Global flags
|
||||
rootCmd.PersistentFlags().StringP("portal", "p", "", "Portal URL")
|
||||
rootCmd.PersistentFlags().BoolP("verbose", "v", false, "Verbose output")
|
||||
|
||||
viper.BindPFlag("portal_url", rootCmd.PersistentFlags().Lookup("portal"))
|
||||
viper.BindPFlag("verbose", rootCmd.PersistentFlags().Lookup("verbose"))
|
||||
|
||||
// Initialize config
|
||||
cmd.InitConfig()
|
||||
|
||||
// Add commands
|
||||
rootCmd.AddCommand(cmd.InitCmd())
|
||||
rootCmd.AddCommand(cmd.ValidateCmd())
|
||||
rootCmd.AddCommand(cmd.BuildCmd())
|
||||
rootCmd.AddCommand(cmd.SignCmd())
|
||||
rootCmd.AddCommand(cmd.RunCmd())
|
||||
rootCmd.AddCommand(cmd.LoginCmd())
|
||||
rootCmd.AddCommand(cmd.LogoutCmd())
|
||||
rootCmd.AddCommand(cmd.PublishCmd())
|
||||
rootCmd.AddCommand(cmd.StatusCmd())
|
||||
rootCmd.AddCommand(cmd.KeysCmd())
|
||||
rootCmd.AddCommand(cmd.ConfigCmd())
|
||||
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user