cmd: exported commands for external use

This commit is contained in:
David Allen 2025-02-04 13:51:57 -07:00
parent 45ee89ffc3
commit fd54f367b8
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
4 changed files with 50 additions and 50 deletions

View file

@ -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)
}