mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
refactor: exported more cmd variables
This commit is contained in:
parent
de8dd3cabd
commit
c0e498766f
4 changed files with 30 additions and 30 deletions
16
cmd/crawl.go
16
cmd/crawl.go
|
|
@ -14,7 +14,7 @@ import (
|
|||
// The `crawl` command walks a collection of Redfish endpoints to collect
|
||||
// specfic inventory detail. This command only expects host names and does
|
||||
// not require a scan to be performed beforehand.
|
||||
var crawlCmd = &cobra.Command{
|
||||
var CrawlCmd = &cobra.Command{
|
||||
Use: "crawl [uri]",
|
||||
Short: "Crawl a single BMC for inventory information",
|
||||
Long: "Crawl a single BMC for inventory information. This command does NOT store information\n" +
|
||||
|
|
@ -57,13 +57,13 @@ var crawlCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
crawlCmd.Flags().StringP("username", "u", "", "Set the username for the BMC")
|
||||
crawlCmd.Flags().StringP("password", "p", "", "Set the password for the BMC")
|
||||
crawlCmd.Flags().BoolP("insecure", "i", false, "Ignore SSL errors")
|
||||
CrawlCmd.Flags().StringP("username", "u", "", "Set the username for the BMC")
|
||||
CrawlCmd.Flags().StringP("password", "p", "", "Set the password for the BMC")
|
||||
CrawlCmd.Flags().BoolP("insecure", "i", false, "Ignore SSL errors")
|
||||
|
||||
checkBindFlagError(viper.BindPFlag("crawl.username", crawlCmd.Flags().Lookup("username")))
|
||||
checkBindFlagError(viper.BindPFlag("crawl.password", crawlCmd.Flags().Lookup("password")))
|
||||
checkBindFlagError(viper.BindPFlag("crawl.insecure", crawlCmd.Flags().Lookup("insecure")))
|
||||
checkBindFlagError(viper.BindPFlag("crawl.username", CrawlCmd.Flags().Lookup("username")))
|
||||
checkBindFlagError(viper.BindPFlag("crawl.password", CrawlCmd.Flags().Lookup("password")))
|
||||
checkBindFlagError(viper.BindPFlag("crawl.insecure", CrawlCmd.Flags().Lookup("insecure")))
|
||||
|
||||
rootCmd.AddCommand(crawlCmd)
|
||||
rootCmd.AddCommand(CrawlCmd)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ var (
|
|||
// The `list` command provides an easy way to show what was found
|
||||
// and stored in a cache database from a scan. The data that's stored
|
||||
// is what is consumed by the `collect` command with the --cache flag.
|
||||
var listCmd = &cobra.Command{
|
||||
var ListCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List information stored in cache from a scan",
|
||||
Long: "Prints all of the host and associated data found from performing a scan.\n" +
|
||||
|
|
@ -55,7 +55,7 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
listCmd.Flags().StringVar(&format, "format", "", "Set the output format (json|default)")
|
||||
listCmd.Flags().BoolVar(&showCache, "cache-info", false, "Show cache information and exit")
|
||||
rootCmd.AddCommand(listCmd)
|
||||
ListCmd.Flags().StringVar(&format, "format", "", "Set the output format (json|default)")
|
||||
ListCmd.Flags().BoolVar(&showCache, "cache-info", false, "Show cache information and exit")
|
||||
rootCmd.AddCommand(ListCmd)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ var (
|
|||
// The `update` command provides an interface to easily update firmware
|
||||
// using Redfish. It also provides a simple way to check the status of
|
||||
// an update in-progress.
|
||||
var updateCmd = &cobra.Command{
|
||||
var UpdateCmd = &cobra.Command{
|
||||
Use: "update hosts...",
|
||||
Short: "Update BMC node firmware",
|
||||
Long: "Perform an firmware update using Redfish by providing a remote firmware URL and component.\n\n" +
|
||||
|
|
@ -78,21 +78,21 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
updateCmd.Flags().StringVar(&username, "username", "", "Set the BMC user")
|
||||
updateCmd.Flags().StringVar(&password, "password", "", "Set the BMC password")
|
||||
updateCmd.Flags().StringVar(&transferProtocol, "scheme", "https", "Set the transfer protocol")
|
||||
updateCmd.Flags().StringVar(&firmwareUrl, "firmware-url", "", "Set the path to the firmware")
|
||||
updateCmd.Flags().StringVar(&firmwareVersion, "firmware-version", "", "Set the version of firmware to be installed")
|
||||
updateCmd.Flags().StringVar(&component, "component", "", "Set the component to upgrade (BMC|BIOS)")
|
||||
updateCmd.Flags().BoolVar(&showStatus, "status", false, "Get the status of the update")
|
||||
UpdateCmd.Flags().StringVar(&username, "username", "", "Set the BMC user")
|
||||
UpdateCmd.Flags().StringVar(&password, "password", "", "Set the BMC password")
|
||||
UpdateCmd.Flags().StringVar(&transferProtocol, "scheme", "https", "Set the transfer protocol")
|
||||
UpdateCmd.Flags().StringVar(&firmwareUrl, "firmware-url", "", "Set the path to the firmware")
|
||||
UpdateCmd.Flags().StringVar(&firmwareVersion, "firmware-version", "", "Set the version of firmware to be installed")
|
||||
UpdateCmd.Flags().StringVar(&component, "component", "", "Set the component to upgrade (BMC|BIOS)")
|
||||
UpdateCmd.Flags().BoolVar(&showStatus, "status", false, "Get the status of the update")
|
||||
|
||||
checkBindFlagError(viper.BindPFlag("update.username", updateCmd.Flags().Lookup("username")))
|
||||
checkBindFlagError(viper.BindPFlag("update.password", updateCmd.Flags().Lookup("password")))
|
||||
checkBindFlagError(viper.BindPFlag("update.scheme", updateCmd.Flags().Lookup("scheme")))
|
||||
checkBindFlagError(viper.BindPFlag("update.firmware-url", updateCmd.Flags().Lookup("firmware-url")))
|
||||
checkBindFlagError(viper.BindPFlag("update.firmware-version", updateCmd.Flags().Lookup("firmware-version")))
|
||||
checkBindFlagError(viper.BindPFlag("update.component", updateCmd.Flags().Lookup("component")))
|
||||
checkBindFlagError(viper.BindPFlag("update.status", updateCmd.Flags().Lookup("status")))
|
||||
checkBindFlagError(viper.BindPFlag("update.username", UpdateCmd.Flags().Lookup("username")))
|
||||
checkBindFlagError(viper.BindPFlag("update.password", UpdateCmd.Flags().Lookup("password")))
|
||||
checkBindFlagError(viper.BindPFlag("update.scheme", UpdateCmd.Flags().Lookup("scheme")))
|
||||
checkBindFlagError(viper.BindPFlag("update.firmware-url", UpdateCmd.Flags().Lookup("firmware-url")))
|
||||
checkBindFlagError(viper.BindPFlag("update.firmware-version", UpdateCmd.Flags().Lookup("firmware-version")))
|
||||
checkBindFlagError(viper.BindPFlag("update.component", UpdateCmd.Flags().Lookup("component")))
|
||||
checkBindFlagError(viper.BindPFlag("update.status", UpdateCmd.Flags().Lookup("status")))
|
||||
|
||||
rootCmd.AddCommand(updateCmd)
|
||||
rootCmd.AddCommand(UpdateCmd)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
var VersionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print version info and exit",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
|
@ -14,5 +14,5 @@ var versionCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
rootCmd.AddCommand(VersionCmd)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue