diff --git a/.travis.yml b/.travis.yml index 5314f8ef2..af5841240 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,4 +31,4 @@ script: - go build -a -v -race ./... # Verify that generated crane docs are up-to-date. - - mkdir -p /tmp/gendoc && go run cmd/crane/help/main.go --dir /tmp/gendoc && diff -I "###### Auto generated" -Naur /tmp/gendoc/ cmd/crane/doc/ + - mkdir -p /tmp/gendoc && go run cmd/crane/help/main.go --dir /tmp/gendoc && diff -Naur /tmp/gendoc/ cmd/crane/doc/ diff --git a/cmd/crane/doc/crane.md b/cmd/crane/doc/crane.md index c9dad8686..3c67d4d4a 100644 --- a/cmd/crane/doc/crane.md +++ b/cmd/crane/doc/crane.md @@ -29,4 +29,3 @@ crane [flags] * [crane push](crane_push.md) - Push image contents as a tarball to a remote registry * [crane rebase](crane_rebase.md) - Rebase an image onto a new base image -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_append.md b/cmd/crane/doc/crane_append.md index 5b45005bf..3e11033bc 100644 --- a/cmd/crane/doc/crane_append.md +++ b/cmd/crane/doc/crane_append.md @@ -13,12 +13,14 @@ crane append [flags] ### Options ``` - -h, --help help for append - -o, --output string Path to new tarball of resulting image + -b, --base string Name of base image to append to + -h, --help help for append + -f, --new_layer string Path to tarball to append to image + -t, --new_tag string Tag to apply to resulting image + -o, --output string Path to new tarball of resulting image ``` ### SEE ALSO * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_config.md b/cmd/crane/doc/crane_config.md index 55e9f7332..2ed7c94fe 100644 --- a/cmd/crane/doc/crane_config.md +++ b/cmd/crane/doc/crane_config.md @@ -20,4 +20,3 @@ crane config [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_copy.md b/cmd/crane/doc/crane_copy.md index bd6d6bd97..c2866c61b 100644 --- a/cmd/crane/doc/crane_copy.md +++ b/cmd/crane/doc/crane_copy.md @@ -20,4 +20,3 @@ crane copy [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_delete.md b/cmd/crane/doc/crane_delete.md index b919f3f48..b9ad7bffe 100644 --- a/cmd/crane/doc/crane_delete.md +++ b/cmd/crane/doc/crane_delete.md @@ -20,4 +20,3 @@ crane delete [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_digest.md b/cmd/crane/doc/crane_digest.md index 573c6df93..0de23c188 100644 --- a/cmd/crane/doc/crane_digest.md +++ b/cmd/crane/doc/crane_digest.md @@ -20,4 +20,3 @@ crane digest [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_ls.md b/cmd/crane/doc/crane_ls.md index 0ed81549a..1e14bb4a0 100644 --- a/cmd/crane/doc/crane_ls.md +++ b/cmd/crane/doc/crane_ls.md @@ -20,4 +20,3 @@ crane ls [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_manifest.md b/cmd/crane/doc/crane_manifest.md index 9775f37fa..e8c91dc32 100644 --- a/cmd/crane/doc/crane_manifest.md +++ b/cmd/crane/doc/crane_manifest.md @@ -20,4 +20,3 @@ crane manifest [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_pull.md b/cmd/crane/doc/crane_pull.md index d4fcf4959..bbe395994 100644 --- a/cmd/crane/doc/crane_pull.md +++ b/cmd/crane/doc/crane_pull.md @@ -20,4 +20,3 @@ crane pull [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_push.md b/cmd/crane/doc/crane_push.md index 0cb6a656e..854c87825 100644 --- a/cmd/crane/doc/crane_push.md +++ b/cmd/crane/doc/crane_push.md @@ -20,4 +20,3 @@ crane push [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/cmd/crane/doc/crane_rebase.md b/cmd/crane/doc/crane_rebase.md index 28075bccc..6886b3213 100644 --- a/cmd/crane/doc/crane_rebase.md +++ b/cmd/crane/doc/crane_rebase.md @@ -24,4 +24,3 @@ crane rebase [flags] * [crane](crane.md) - Crane is a tool for managing container images -###### Auto generated by spf13/cobra on 2-Jun-2018 diff --git a/pkg/crane/append.go b/pkg/crane/append.go index 361af0fc9..2b0b0b771 100644 --- a/pkg/crane/append.go +++ b/pkg/crane/append.go @@ -30,17 +30,23 @@ import ( func init() { Root.AddCommand(NewCmdAppend()) } func NewCmdAppend() *cobra.Command { - var output string + var baseRef, newTag, newLayer, outFile string appendCmd := &cobra.Command{ Use: "append", Short: "Append contents of a tarball to a remote image", - Args: cobra.ExactArgs(3), + Args: cobra.NoArgs, Run: func(_ *cobra.Command, args []string) { - src, dst, tar := args[0], args[1], args[2] - doAppend(src, dst, tar, output) + doAppend(baseRef, newTag, newLayer, outFile) }, } - appendCmd.Flags().StringVarP(&output, "output", "o", "", "Path to new tarball of resulting image") + appendCmd.Flags().StringVarP(&baseRef, "base", "b", "", "Name of base image to append to") + appendCmd.Flags().StringVarP(&newTag, "new_tag", "t", "", "Tag to apply to resulting image") + appendCmd.Flags().StringVarP(&newLayer, "new_layer", "f", "", "Path to tarball to append to image") + appendCmd.Flags().StringVarP(&outFile, "output", "o", "", "Path to new tarball of resulting image") + + appendCmd.MarkFlagRequired("base") + appendCmd.MarkFlagRequired("new_tag") + appendCmd.MarkFlagRequired("new_layer") return appendCmd } diff --git a/pkg/crane/rebase.go b/pkg/crane/rebase.go index e85fb49ae..66bdb8695 100644 --- a/pkg/crane/rebase.go +++ b/pkg/crane/rebase.go @@ -42,6 +42,11 @@ func NewCmdRebase() *cobra.Command { rebaseCmd.Flags().StringVarP(&oldBase, "old_base", "", "", "Old base image to remove") rebaseCmd.Flags().StringVarP(&newBase, "new_base", "", "", "New base image to insert") rebaseCmd.Flags().StringVarP(&rebased, "rebased", "", "", "Tag to apply to rebased image") + + rebaseCmd.MarkFlagRequired("original") + rebaseCmd.MarkFlagRequired("old_base") + rebaseCmd.MarkFlagRequired("new_base") + rebaseCmd.MarkFlagRequired("rebased") return rebaseCmd } diff --git a/pkg/crane/root.go b/pkg/crane/root.go index f23aa0b15..cc251a690 100644 --- a/pkg/crane/root.go +++ b/pkg/crane/root.go @@ -15,7 +15,8 @@ package crane import "github.com/spf13/cobra" var Root = &cobra.Command{ - Use: "crane", - Short: "Crane is a tool for managing container images", - Run: func(cmd *cobra.Command, _ []string) { cmd.Usage() }, + Use: "crane", + Short: "Crane is a tool for managing container images", + Run: func(cmd *cobra.Command, _ []string) { cmd.Usage() }, + DisableAutoGenTag: true, }