MCPcopy
hub / github.com/larksuite/cli / handleShortcutDryRun

Function handleShortcutDryRun

shortcuts/common/runner.go:1142–1155  ·  view source on GitHub ↗
(f *cmdutil.Factory, rctx *RuntimeContext, s *Shortcut)

Source from the content-addressed store, hash-verified

1140}
1141
1142func 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

Calls 4

PrintJsonFunction · 0.92
ValidationErrorfFunction · 0.85
WithParamMethod · 0.80
FormatMethod · 0.80