diff --git a/go.mod b/go.mod index 765252299e..91421a922c 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/moby/term v0.5.0 github.com/spf13/cobra v1.7.0 + github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 github.com/vincent-petithory/dataurl v1.0.0 github.com/xeipuuv/gojsonschema v1.2.0 @@ -174,7 +175,6 @@ require ( github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.13.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect diff --git a/pkg/cli/build.go b/pkg/cli/build.go index aaf7acf6b3..69fd178218 100644 --- a/pkg/cli/build.go +++ b/pkg/cli/build.go @@ -4,6 +4,7 @@ import ( "os" "github.com/spf13/cobra" + "github.com/spf13/pflag" "github.com/replicate/cog/pkg/config" "github.com/replicate/cog/pkg/image" @@ -90,4 +91,9 @@ func addUseCudaBaseImageFlag(cmd *cobra.Command) { func addDockerfileFlag(cmd *cobra.Command) { cmd.Flags().StringVar(&buildDockerfileFile, "dockerfile", "", "Path to a Dockerfile. If set, cog will use this Dockerfile instead of generating one from cog.yaml") + cmd.Flags().VisitAll(func(f *pflag.Flag) { + if f.Name == "dockerfile" { + f.Hidden = true + } + }) }