Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import (
"github.com/replicate/cog/pkg/util/console"
)

func init() {
// Allow child commands to define their own PersistentPreRun hooks
// without shadowing the root command's. Cobra will invoke them in
// order from root → child.
cobra.EnableTraverseRunHooks = true
}

func NewRootCommand() (*cobra.Command, error) {
rootCmd := cobra.Command{
Use: "cog",
Expand Down
14 changes: 11 additions & 3 deletions pkg/cli/weights.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ import (

func newWeightsCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "weights",
Short: "Manage model weights",
Long: "Commands for managing model weight files.",
Use: "weights",
Short: "Manage model weights (experimental)",
Long: `Commands for managing model weight files.

NOTE: cog weights is experimental. Behavior may change in future versions.
Do not rely on it in production workflows.`,
Hidden: true,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
console.Warnf("NOTE: cog weights is experimental. Behavior may change in future versions.")
console.Warnf("Do not rely on it in production workflows.")
console.Info("")
},
}

cmd.AddCommand(newWeightsImportCommand())
Expand Down