()
| 537 | } |
| 538 | |
| 539 | func newStorageDownloadTemplateCmd() *cobra.Command { |
| 540 | cmd := &cobra.Command{ |
| 541 | Use: "template <node> <storage> <template>", |
| 542 | Short: "Download an appliance template", |
| 543 | Long: `Download an appliance template from the Proxmox catalog. |
| 544 | |
| 545 | <template> may be a full filename (e.g. debian-12-standard_12.7-1_amd64.tar.zst) or |
| 546 | a package name (e.g. debian-12-standard). When a package name is given, the latest |
| 547 | version is resolved automatically and the resolved filename is printed to stderr.`, |
| 548 | Args: cobra.ExactArgs(3), |
| 549 | Example: ` pvetui storage download template pve01 local debian-12-standard |
| 550 | pvetui storage download template pve01 local debian-12-standard --section system |
| 551 | pvetui storage download template pve01 local debian-12-standard_12.7-1_amd64.tar.zst`, |
| 552 | RunE: runStorageDownloadTemplate, |
| 553 | } |
| 554 | |
| 555 | cmd.Flags().String("section", "", "Narrow template resolution by section (system, mail, turnkeylinux)") |
| 556 | cmd.Flags().StringP("output", "o", "json", "Output format: json or table") |
| 557 | addNoWaitFlag(cmd) |
| 558 | |
| 559 | cmd.ValidArgsFunction = completeTemplateNames |
| 560 | |
| 561 | return cmd |
| 562 | } |
| 563 | |
| 564 | func runStorageDownloadTemplate(cmd *cobra.Command, args []string) error { |
| 565 | ctx := context.Background() |
no test coverage detected