| 1140 | } |
| 1141 | |
| 1142 | func handleShortcutDryRun(f *cmdutil.Factory, rctx *RuntimeContext, s *Shortcut) error { |
| 1143 | if s.DryRun == nil { |
| 1144 | return ValidationErrorf("--dry-run is not supported for %s %s", s.Service, s.Command). |
| 1145 | WithParam("--dry-run") |
| 1146 | } |
| 1147 | fmt.Fprintln(f.IOStreams.ErrOut, "=== Dry Run ===") |
| 1148 | dryResult := s.DryRun(rctx.ctx, rctx) |
| 1149 | if rctx.Format == "pretty" { |
| 1150 | fmt.Fprint(f.IOStreams.Out, dryResult.Format()) |
| 1151 | } else { |
| 1152 | output.PrintJson(f.IOStreams.Out, dryResult) |
| 1153 | } |
| 1154 | return nil |
| 1155 | } |
| 1156 | |
| 1157 | // rejectPositionalArgs returns a cobra.PositionalArgs that rejects any |
| 1158 | // positional arguments. It returns a plain cobra usage error; the root |