1
0
mirror of https://github.com/rancher/cli.git synced 2026-02-06 12:48:45 +01:00
Files
cli/cmd/util_ls.go
Enrico Candino 0e8a1106be Added linter and removed deprecated and unused packages (#357)
* Create go.yml

* updated golangci config file

* renamed action file

* removed unused prompt command

* fixed SA6005 (staticcheck): used strings.EqualFold

* removed unused monitor package

* removed unused funcs and fields

* fixed SA1019 (staticcheck): removed deprecations

* added missing error checking

* fixed linter

* removed unused (and unimplemented) commands

* added error to getClusterK8sOptions

* oneliner err check in displayListServers

* removed unused docker dependency
2024-04-10 11:52:59 +02:00

35 lines
666 B
Go

package cmd
import (
"github.com/rancher/norman/types"
"github.com/urfave/cli"
)
func baseListOpts() *types.ListOpts {
return &types.ListOpts{
Filters: map[string]interface{}{
"limit": -1,
"all": true,
},
}
}
func defaultListOpts(ctx *cli.Context) *types.ListOpts {
listOpts := baseListOpts()
if ctx != nil && !ctx.Bool("all") {
listOpts.Filters["removed_null"] = "1"
listOpts.Filters["state_ne"] = []string{
"inactive",
"stopped",
"removing",
}
delete(listOpts.Filters, "all")
}
if ctx != nil && ctx.Bool("system") {
delete(listOpts.Filters, "system")
} else {
listOpts.Filters["system"] = "false"
}
return listOpts
}