refactor: improvements to CLI and update pkg

This commit is contained in:
David Allen 2025-03-28 13:12:38 -06:00 committed by David Allen
parent b7761c2cbf
commit 92b05a81c7
Signed by: towk
GPG key ID: 0430CDBE22619155
8 changed files with 86 additions and 87 deletions

View file

@ -52,7 +52,7 @@ var (
var rootCmd = &cobra.Command{
Use: "magellan",
Short: "Redfish-based BMC discovery tool",
Long: "",
Long: "Redfish-based BMC discovery tool with dynamic discovery features.",
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
err := cmd.Help()
@ -75,8 +75,8 @@ func Execute() {
func init() {
currentUser, _ = user.Current()
cobra.OnInitialize(InitializeConfig)
rootCmd.PersistentFlags().IntVar(&concurrency, "concurrency", -1, "Set the number of concurrent processes")
rootCmd.PersistentFlags().IntVar(&timeout, "timeout", 5, "Set the timeout for requests")
rootCmd.PersistentFlags().IntVarP(&concurrency, "concurrency", "j", -1, "Set the number of concurrent processes")
rootCmd.PersistentFlags().IntVarP(&timeout, "timeout", "t", 5, "Set the timeout for requests")
rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "Set the config file path")
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Set to enable/disable verbose output")
rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "Set to enable/disable debug messages")
@ -94,7 +94,7 @@ func init() {
func checkBindFlagError(err error) {
if err != nil {
log.Error().Err(err).Msg("failed to bind flag")
log.Error().Err(err).Msg("failed to bind cobra/viper flag")
}
}