Merge branch 'main' into manager-data

Signed-off-by: David Allen <16520934+davidallendj@users.noreply.github.com>
This commit is contained in:
David Allen 2024-10-24 17:57:00 -06:00 committed by GitHub
commit 9e289b4946
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 50 additions and 64 deletions

View file

@ -74,13 +74,13 @@ 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")
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")
rootCmd.PersistentFlags().StringVar(&accessToken, "access-token", "", "set the access token")
rootCmd.PersistentFlags().StringVar(&cachePath, "cache", fmt.Sprintf("/tmp/%s/magellan/assets.db", currentUser.Username), "set the scanning result cache path")
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().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")
rootCmd.PersistentFlags().StringVar(&accessToken, "access-token", "", "Set the access token")
rootCmd.PersistentFlags().StringVar(&cachePath, "cache", fmt.Sprintf("/tmp/%s/magellan/assets.db", currentUser.Username), "Set the scanning result cache path")
// bind viper config flags with cobra
checkBindFlagError(viper.BindPFlag("concurrency", rootCmd.PersistentFlags().Lookup("concurrency")))

View file

@ -14,16 +14,17 @@ var (
)
var versionCmd = &cobra.Command{
Use: "version",
Use: "version",
Short: "Print version info and exit",
Run: func(cmd *cobra.Command, args []string) {
if cmd.Flag("commit").Value.String() == "true" {
output = commit
if date != "" {
output += " built @ " + date
output += " built on " + date
}
fmt.Println(output)
} else {
fmt.Println(version)
fmt.Printf("%s-%s\n", version, commit)
}
},
}