(deps commandDeps)
| 50 | } |
| 51 | |
| 52 | func newSupportBundleCommand(deps commandDeps) *cobra.Command { |
| 53 | var opts supportBundleOptions |
| 54 | cmd := &cobra.Command{ |
| 55 | Use: supportBundleKey, |
| 56 | Short: "Create and download a redacted support bundle", |
| 57 | Example: strings.Join([]string{ |
| 58 | " # Create a bundle and write it under $AGH_HOME/support-bundles", |
| 59 | " agh support bundle --yes", |
| 60 | "", |
| 61 | " # Write the daemon-built bundle to a specific path", |
| 62 | " agh support bundle --yes --output /tmp/agh-support-bundle.tar.gz", |
| 63 | }, "\n"), |
| 64 | Args: cobra.NoArgs, |
| 65 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 66 | return runSupportBundleCommand(cmd, deps, opts) |
| 67 | }, |
| 68 | } |
| 69 | cmd.Flags().StringVar(&opts.outputPath, outputFlagName, "", "Path or directory for the downloaded bundle") |
| 70 | cmd.Flags().BoolVar(&opts.yes, yesFlagName, false, "Confirm support bundle creation without an interactive prompt") |
| 71 | cmd.Flags().BoolVar( |
| 72 | &opts.noStatus, |
| 73 | "no-status", |
| 74 | false, |
| 75 | "Omit status.json, doctor.json, providers.json, and runtime status snapshots", |
| 76 | ) |
| 77 | return cmd |
| 78 | } |
| 79 | |
| 80 | func runSupportBundleCommand(cmd *cobra.Command, deps commandDeps, opts supportBundleOptions) error { |
| 81 | confirmed, err := confirmSupportBundleCreation(cmd, opts.yes) |
no test coverage detected