()
| 26 | ) |
| 27 | |
| 28 | func newCmdPluginDocsUpload() *cobra.Command { |
| 29 | cmd := &cobra.Command{ |
| 30 | Use: "upload [-D docs] [--sync] <team_name>/<plugin_kind>/<plugin_name>@<version>", |
| 31 | Short: pluginDocsUploadShort, |
| 32 | Long: pluginDocsUploadLong, |
| 33 | Example: pluginDocsUploadExample, |
| 34 | Args: cobra.ExactArgs(1), |
| 35 | RunE: func(cmd *cobra.Command, args []string) error { |
| 36 | // Set up a channel to listen for OS signals for graceful shutdown. |
| 37 | ctx, cancel := context.WithCancel(cmd.Context()) |
| 38 | |
| 39 | sigChan := make(chan os.Signal, 1) |
| 40 | signal.Notify(sigChan, syscall.SIGTERM) |
| 41 | |
| 42 | go func() { |
| 43 | <-sigChan |
| 44 | cancel() |
| 45 | }() |
| 46 | |
| 47 | return runPluginDocsUpload(ctx, cmd, args) |
| 48 | }, |
| 49 | } |
| 50 | cmd.Flags().StringP("docs-dir", "D", "docs", "Path to the docs directory") |
| 51 | cmd.Flags().Bool("sync", false, "Synchronize docs with CloudQuery Hub, deleting any docs that are not present locally") |
| 52 | |
| 53 | return cmd |
| 54 | } |
| 55 | |
| 56 | func runPluginDocsUpload(ctx context.Context, cmd *cobra.Command, args []string) error { |
| 57 | tc := auth.NewTokenClient() |
no test coverage detected