albatros/cmd/container.go

39 lines
975 B
Go
Raw Normal View History

2023-04-28 10:05:22 +00:00
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
const distributionPrefix = "v2"
//---
//--- Command logic
var containerCmd = &cobra.Command{
Use: "container",
Short: "Manage container images",
Long: "Publish software on an S3 target following the OCI specification",
}
var containerTag string
var containerPublishCmd = &cobra.Command{
Use: "push [folder] [remote]", // https://gocloud.dev/howto/blob/#s3-compatible
Short: "Publish a container image",
Long: "Copy .tar.gz files in the specified folder on the S3 target so that they match the OCI distribution specification",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("✅ push succeeded\n")
},
}
func init() {
containerPublishCmd.Flags().StringVarP(&containerTag, "tag", "t", "", "Tag of the project, eg. albatros:0.9")
containerPublishCmd.MarkFlagRequired("tag")
containerCmd.AddCommand(containerPublishCmd)
RootCmd.AddCommand(containerCmd)
}