abra/cli/newcli.go

47 lines
861 B
Go

package cli
import (
"fmt"
"coopcloud.tech/abra/pkg/log"
"github.com/spf13/cobra"
)
var (
Debug bool
Offline bool
NoInput bool
)
func RunApp2(version, commit string) {
rootCmd := &cobra.Command{
Use: "abra",
Short: "The Co-op Cloud command-line utility belt 🎩🐇",
Version: fmt.Sprintf("%s-%s", version, commit[:7]),
PreRun: func(cmd *cobra.Command, args []string) {
log.Info("HELLO LOGGING")
},
}
rootCmd.PersistentFlags().BoolVarP(
&Debug, "debug", "d", false,
"show debug messages",
)
rootCmd.PersistentFlags().BoolVarP(
&NoInput, "no-input", "n", false,
"toggle non-interactive mode",
)
rootCmd.PersistentFlags().BoolVarP(
&Offline, "offline", "o", false,
"prefer offline & filesystem access",
)
rootCmd.AddCommand(UpgradeCommand)
if err := rootCmd.Execute(); err != nil {
log.Fatal(err)
}
}