Skip to content

Commit

Permalink
Disable sorting of flags in help text
Browse files Browse the repository at this point in the history
  • Loading branch information
amisevsk committed Jul 11, 2024
1 parent 7529238 commit e555301
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,18 @@ func RunCommand() *cobra.Command {
},
}
addSubcommands(cmd)
cmd.PersistentFlags().StringVar(&opts.configHome, "config", "", "Alternate path to root storage directory for CLI")
cmd.PersistentFlags().CountVarP(&opts.verbosity, "verbose", "v", "Increase verbosity of output (use -vv for more)")
cmd.PersistentFlags().StringVar(&opts.loglevel, "log-level", "info", "Log messages above specified level ('trace', 'debug', 'info', 'warn', 'error') (default 'info')")
cmd.PersistentFlags().StringVar(&opts.progressBars, "progress", "plain", "Configure progress bars for longer operations (options: none, plain, fancy)")
cmd.PersistentFlags().StringVar(&opts.configHome, "config", "", "Alternate path to root storage directory for CLI")
cmd.PersistentFlags().CountVarP(&opts.verbosity, "verbose", "v", "Increase verbosity of output (use -vv for more)")
cmd.PersistentFlags().SortFlags = false
cmd.Flags().SortFlags = false

cmd.SetHelpTemplate(helpTemplate)
cmd.SetUsageTemplate(usageTemplate)
cobra.AddTemplateFunc("indent", indentBlock)
cobra.AddTemplateFunc("sectionHead", sectionHead)
cobra.AddTemplateFunc("ensureTrailingNewline", ensureTrailingNewline)

return cmd
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/dev/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func DevStartCommand() *cobra.Command {
cmd.Flags().StringVarP(&opts.modelFile, "file", "f", "", "Path to the kitfile")
cmd.Flags().StringVar(&opts.host, "host", "127.0.0.1", "Host for the development server")
cmd.Flags().IntVar(&opts.port, "port", 0, "Port for development server to listen on")
cmd.Flags().SortFlags = false

return cmd
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/info/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func InfoCommand() *cobra.Command {

opts.AddNetworkFlags(cmd)
cmd.Flags().BoolVarP(&opts.checkRemote, "remote", "r", false, "Check remote registry instead of local storage")
cmd.Flags().SortFlags = false

return cmd
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/inspect/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func InspectCommand() *cobra.Command {

opts.AddNetworkFlags(cmd)
cmd.Flags().BoolVarP(&opts.checkRemote, "remote", "r", false, "Check remote registry instead of local storage")
cmd.Flags().SortFlags = false

return cmd
}

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/list/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func ListCommand() *cobra.Command {

cmd.Args = cobra.MaximumNArgs(1)
opts.AddNetworkFlags(cmd)
cmd.Flags().SortFlags = false

return cmd
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/login/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func LoginCommand() *cobra.Command {
cmd.Flags().StringVarP(&opts.password, "password", "p", "", "registry password or token")
cmd.Flags().BoolVar(&opts.passwordFromStdIn, "password-stdin", false, "read password from stdin")
opts.AddNetworkFlags(cmd)
cmd.Flags().SortFlags = false

return cmd
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/pack/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func PackCommand() *cobra.Command {
cmd.Flags().StringVarP(&opts.modelFile, "file", "f", "", "Specifies the path to the Kitfile explictly (use \"-\" to read from standard input)")
cmd.Flags().StringVarP(&opts.fullTagRef, "tag", "t", "", "Assigns one or more tags to the built modelkit. Example: -t registry/repository:tag1,tag2")
cmd.Flags().StringVar(&opts.compression, "compression", "none", "Compression format to use for layers. Valid options: 'none' (default), 'gzip', 'gzip-fastest'")
cmd.Flags().SortFlags = false
cmd.Args = cobra.ExactArgs(1)
return cmd
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/pull/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func PullCommand() *cobra.Command {

cmd.Args = cobra.ExactArgs(1)
opts.AddNetworkFlags(cmd)
cmd.Flags().SortFlags = false

return cmd
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/push/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func PushCommand() *cobra.Command {

cmd.Args = cobra.ExactArgs(1)
opts.AddNetworkFlags(cmd)
cmd.Flags().SortFlags = false

return cmd
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/remove/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func RemoveCommand() *cobra.Command {
cmd.Flags().BoolVarP(&opts.removeAll, "all", "a", false, "remove all untagged modelkits")
cmd.Flags().BoolVarP(&opts.remote, "remote", "r", false, "remove modelkit from remote registry")
opts.AddNetworkFlags(cmd)
cmd.Flags().SortFlags = false

cmd.Args = func(cmd *cobra.Command, args []string) error {
switch len(args) {
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/unpack/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func UnpackCommand() *cobra.Command {
cmd.Flags().BoolVar(&opts.unpackConf.unpackDatasets, "datasets", false, "Unpack only datasets")
cmd.Flags().BoolVar(&opts.unpackConf.unpackDocs, "docs", false, "Unpack only docs")
opts.AddNetworkFlags(cmd)
cmd.Flags().SortFlags = false

return cmd
}
Expand Down

0 comments on commit e555301

Please sign in to comment.