()
| 30 | ) |
| 31 | |
| 32 | func newCmdPluginDocsDownload() *cobra.Command { |
| 33 | cmd := &cobra.Command{ |
| 34 | Use: "download [-D docs] <team_name>/<plugin_kind>/<plugin_name>@<version>", |
| 35 | Short: pluginDocsDownloadShort, |
| 36 | Long: pluginDocsDownloadLong, |
| 37 | Example: pluginDocsDownloadExample, |
| 38 | Args: cobra.ExactArgs(1), |
| 39 | RunE: func(cmd *cobra.Command, args []string) error { |
| 40 | // Set up a channel to listen for OS signals for graceful shutdown. |
| 41 | ctx, cancel := context.WithCancel(cmd.Context()) |
| 42 | |
| 43 | sigChan := make(chan os.Signal, 1) |
| 44 | signal.Notify(sigChan, syscall.SIGTERM) |
| 45 | |
| 46 | go func() { |
| 47 | <-sigChan |
| 48 | cancel() |
| 49 | }() |
| 50 | |
| 51 | return runPluginDocsDownload(ctx, cmd, args) |
| 52 | }, |
| 53 | } |
| 54 | cmd.Flags().StringP("docs-dir", "D", "docs", "Path to the docs directory") |
| 55 | |
| 56 | return cmd |
| 57 | } |
| 58 | |
| 59 | func runPluginDocsDownload(ctx context.Context, cmd *cobra.Command, args []string) error { |
| 60 | tc := auth.NewTokenClient() |
no test coverage detected