diff --git a/cmd/attach.go b/cmd/attach.go index 064b579f..1cc03df3 100644 --- a/cmd/attach.go +++ b/cmd/attach.go @@ -31,12 +31,11 @@ var attachConfig = config.NewAttach() // attachCmd represents the modctl command for attach. var attachCmd = &cobra.Command{ - Use: "attach [flags] ", - Short: "Attach the file to an existing model artifact.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "attach [flags] ", + Short: "Attach the file to an existing model artifact.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := attachConfig.Validate(); err != nil { return err diff --git a/cmd/build.go b/cmd/build.go index 25271829..f4e76cd5 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -31,12 +31,11 @@ var buildConfig = config.NewBuild() // buildCmd represents the modctl command for build. var buildCmd = &cobra.Command{ - Use: "build [flags] ", - Short: "Build the model artifact with the context by specified path.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "build [flags] ", + Short: "Build the model artifact with the context by specified path.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := buildConfig.Validate(); err != nil { return err diff --git a/cmd/extract.go b/cmd/extract.go index f71ef64a..d5107bf1 100644 --- a/cmd/extract.go +++ b/cmd/extract.go @@ -31,12 +31,11 @@ var extractConfig = config.NewExtract() // extractCmd represents the modctl command for extract. var extractCmd = &cobra.Command{ - Use: "extract --output ", - Short: "Extract the model artifact to the output path, which can restore the initial state of the model files.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "extract --output ", + Short: "Extract the model artifact to the output path, which can restore the initial state of the model files.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := extractConfig.Validate(); err != nil { return err diff --git a/cmd/fetch.go b/cmd/fetch.go index f501ba69..14835d36 100644 --- a/cmd/fetch.go +++ b/cmd/fetch.go @@ -31,12 +31,11 @@ var fetchConfig = config.NewFetch() // fetchCmd represents the modctl command for fetch. var fetchCmd = &cobra.Command{ - Use: "fetch [flags] ", - Short: "Fetch can retrieve files from the remote model repository, enabling selective download of partial model files by filtering based on file path patterns.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "fetch [flags] ", + Short: "Fetch can retrieve files from the remote model repository, enabling selective download of partial model files by filtering based on file path patterns.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := fetchConfig.Validate(); err != nil { return err diff --git a/cmd/inspect.go b/cmd/inspect.go index 3fde9d57..8bc14158 100644 --- a/cmd/inspect.go +++ b/cmd/inspect.go @@ -32,12 +32,11 @@ var inspectConfig = config.NewInspect() // inspectCmd represents the modctl command for inspect. var inspectCmd = &cobra.Command{ - Use: "inspect [flags] ", - Short: "Inspect can help to analyze the composition of model artifact.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "inspect [flags] ", + Short: "Inspect can help to analyze the composition of model artifact.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { return runInspect(context.Background(), args[0]) }, diff --git a/cmd/list.go b/cmd/list.go index 74c8ae6f..15d7bb40 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -31,12 +31,11 @@ import ( // listCmd represents the modctl command for list. var listCmd = &cobra.Command{ - Use: "ls", - Short: "List will lists the current built model artifacts from local storage.", - Args: cobra.NoArgs, - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "ls", + Short: "List will lists the current built model artifacts from local storage.", + Args: cobra.NoArgs, + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { return runList(context.Background()) }, diff --git a/cmd/login.go b/cmd/login.go index 9e898532..d9f94394 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -43,10 +43,9 @@ modctl login -u foo registry-1.docker.io # login to registry served over http: modctl login -u foo --plain-http registry-insecure.io `, - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := loginConfig.Validate(); err != nil { return err diff --git a/cmd/logout.go b/cmd/logout.go index 19055d79..0bd737b2 100644 --- a/cmd/logout.go +++ b/cmd/logout.go @@ -28,12 +28,11 @@ import ( // logoutCmd represents the modctl command for logout. var logoutCmd = &cobra.Command{ - Use: "logout [flags]", - Short: "Logout from a registry.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "logout [flags]", + Short: "Logout from a registry.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { return runLogout(context.Background(), args[0]) }, diff --git a/cmd/modelfile/generate.go b/cmd/modelfile/generate.go index d68a12f5..3b5dad9f 100644 --- a/cmd/modelfile/generate.go +++ b/cmd/modelfile/generate.go @@ -65,10 +65,9 @@ Full URLs with domain names will auto-detect the provider.`, # Generate with metadata overrides modctl modelfile generate ./my-model-dir --name my-custom-model --family llama3`, - Args: cobra.MaximumNArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Args: cobra.MaximumNArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { // If model-url is provided, path is optional workspace := "." diff --git a/cmd/modelfile/modelfile.go b/cmd/modelfile/modelfile.go index e89563f1..eb0bfaaf 100644 --- a/cmd/modelfile/modelfile.go +++ b/cmd/modelfile/modelfile.go @@ -23,12 +23,11 @@ import ( // RootCmd represents the modelfile tools command for modelfile operation. var RootCmd = &cobra.Command{ - Use: "modelfile", - Short: "A command line tool for modelfile operation", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "modelfile", + Short: "A command line tool for modelfile operation", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { return nil }, diff --git a/cmd/prune.go b/cmd/prune.go index 0004ac3b..27b6e6c8 100644 --- a/cmd/prune.go +++ b/cmd/prune.go @@ -31,12 +31,11 @@ var pruneConfig = config.NewPrune() // pruneCmd represents the modctl command for prune. var pruneCmd = &cobra.Command{ - Use: "prune [flags]", - Short: "Prune can help to cleanup useless manifests and blobs in the local storage.", - Args: cobra.NoArgs, - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "prune [flags]", + Short: "Prune can help to cleanup useless manifests and blobs in the local storage.", + Args: cobra.NoArgs, + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { return runPrune(context.Background()) }, diff --git a/cmd/pull.go b/cmd/pull.go index 52904107..b04dd437 100644 --- a/cmd/pull.go +++ b/cmd/pull.go @@ -31,12 +31,11 @@ var pullConfig = config.NewPull() // pullCmd represents the modctl command for pull. var pullCmd = &cobra.Command{ - Use: "pull [flags] ", - Short: "Pull a model artifact from the remote registry.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "pull [flags] ", + Short: "Pull a model artifact from the remote registry.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := pullConfig.Validate(); err != nil { return err diff --git a/cmd/push.go b/cmd/push.go index 5fb41c38..fc6ed974 100644 --- a/cmd/push.go +++ b/cmd/push.go @@ -31,12 +31,11 @@ var pushConfig = config.NewPush() // pushCmd represents the modctl command for push. var pushCmd = &cobra.Command{ - Use: "push [flags] ", - Short: "Push a model artifact to the remote registry.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "push [flags] ", + Short: "Push a model artifact to the remote registry.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := pushConfig.Validate(); err != nil { return err diff --git a/cmd/rm.go b/cmd/rm.go index 0f6677d5..21b26786 100644 --- a/cmd/rm.go +++ b/cmd/rm.go @@ -28,12 +28,11 @@ import ( // rmCmd represents the modctl command for rm. var rmCmd = &cobra.Command{ - Use: "rm [flags] ", - Short: "Remove a model artifact from the local storage.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "rm [flags] ", + Short: "Remove a model artifact from the local storage.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { return runRm(context.Background(), args[0]) }, diff --git a/cmd/tag.go b/cmd/tag.go index ac8568c2..e34848bf 100644 --- a/cmd/tag.go +++ b/cmd/tag.go @@ -28,12 +28,11 @@ import ( // tagCmd represents the modctl command for tag. var tagCmd = &cobra.Command{ - Use: "tag [flags] ", - Short: "Tag can tag one model artifact to another one without rebuilding.", - Args: cobra.ExactArgs(2), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "tag [flags] ", + Short: "Tag can tag one model artifact to another one without rebuilding.", + Args: cobra.ExactArgs(2), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { return runTag(context.Background(), args[0], args[1]) }, diff --git a/cmd/upload.go b/cmd/upload.go index 10b50eae..e3da9037 100644 --- a/cmd/upload.go +++ b/cmd/upload.go @@ -31,12 +31,11 @@ var uploadConfig = config.NewUpload() // uploadCmd represents the modctl command for upload. var uploadCmd = &cobra.Command{ - Use: "upload [flags] ", - Short: "Upload a file to the remote end in advance to save time in the later build, applicable to the scenario of uploading while downloading, this function needs to be used together with build.", - Args: cobra.ExactArgs(1), - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "upload [flags] ", + Short: "Upload a file to the remote end in advance to save time in the later build, applicable to the scenario of uploading while downloading, this function needs to be used together with build.", + Args: cobra.ExactArgs(1), + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if err := uploadConfig.Validate(); err != nil { return err diff --git a/cmd/version.go b/cmd/version.go index a7c39a56..a35eec53 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -27,11 +27,10 @@ import ( // versionCmd represents the modctl command for version. var versionCmd = &cobra.Command{ - Use: "version", - Short: "A command line tool for modctl version", - DisableAutoGenTag: true, - SilenceUsage: true, - FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true}, + Use: "version", + Short: "A command line tool for modctl version", + DisableAutoGenTag: true, + SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { return runVersion() },