()
| 31 | ) |
| 32 | |
| 33 | func newCmdPluginPublish() *cobra.Command { |
| 34 | cmd := &cobra.Command{ |
| 35 | Use: "publish [-D dist]", |
| 36 | Short: pluginPublishShort, |
| 37 | Long: pluginPublishLong, |
| 38 | Example: pluginPublishExample, |
| 39 | Args: cobra.MaximumNArgs(1), |
| 40 | RunE: func(cmd *cobra.Command, args []string) error { |
| 41 | // Set up a channel to listen for OS signals for graceful shutdown. |
| 42 | ctx, cancel := context.WithCancel(cmd.Context()) |
| 43 | |
| 44 | sigChan := make(chan os.Signal, 1) |
| 45 | signal.Notify(sigChan, syscall.SIGTERM) |
| 46 | |
| 47 | go func() { |
| 48 | <-sigChan |
| 49 | cancel() |
| 50 | }() |
| 51 | |
| 52 | return runPluginPublish(ctx, cmd, args) |
| 53 | }, |
| 54 | } |
| 55 | cmd.Flags().StringP("dist-dir", "D", "dist", "Path to the dist directory") |
| 56 | cmd.Flags().StringP("ui-dir", "U", "", "Path to the built plugin UI directory") |
| 57 | cmd.Flags().BoolP("finalize", "f", false, `Finalize the plugin version after publishing. If false, the plugin version will be marked as draft.`) |
| 58 | |
| 59 | return cmd |
| 60 | } |
| 61 | |
| 62 | func runPluginPublish(ctx context.Context, cmd *cobra.Command, args []string) error { |
| 63 | tc := auth.NewTokenClient() |
no test coverage detected