mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Integrate --format flag docs helper with commands
This commit is contained in:
parent
65c7b6cafc
commit
9551afd432
@ -92,16 +92,7 @@ func init() {
|
||||
configListCmd.Flags().String("format", "", "Format output using a Go template.")
|
||||
viper.BindPFlag("config.list.format", configListCmd.Flags().Lookup("format"))
|
||||
|
||||
configListCmd.SetUsageTemplate(configListCmd.UsageTemplate() + `
|
||||
Format:
|
||||
The --format flag accepts a Go template, which is executed in an object with this structure:
|
||||
|
||||
{
|
||||
Key string
|
||||
EnvironmentVariable string
|
||||
CurrentValue string
|
||||
}
|
||||
`)
|
||||
configListCmd.SetUsageTemplate(configListCmd.UsageTemplate() + common.GetFormatHelp(config{}))
|
||||
}
|
||||
|
||||
type config struct {
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
|
||||
"github.com/greenled/portainer-stack-utils/common"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
@ -62,4 +64,6 @@ func init() {
|
||||
|
||||
endpointGroupListCmd.Flags().String("format", "", "Format output using a Go template.")
|
||||
viper.BindPFlag("endpoint.group.list.format", endpointGroupListCmd.Flags().Lookup("format"))
|
||||
|
||||
endpointGroupListCmd.SetUsageTemplate(endpointGroupListCmd.UsageTemplate() + common.GetFormatHelp(portainer.EndpointGroup{}))
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import (
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
|
||||
"github.com/greenled/portainer-stack-utils/common"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
@ -90,4 +92,6 @@ func init() {
|
||||
|
||||
endpointListCmd.Flags().String("format", "", "Format output using a Go template.")
|
||||
viper.BindPFlag("endpoint.list.format", endpointListCmd.Flags().Lookup("format"))
|
||||
|
||||
endpointListCmd.SetUsageTemplate(endpointListCmd.UsageTemplate() + common.GetFormatHelp(portainer.Endpoint{}))
|
||||
}
|
||||
|
@ -98,4 +98,6 @@ func init() {
|
||||
stackListCmd.Flags().String("format", "", "Format output using a Go template.")
|
||||
viper.BindPFlag("stack.list.endpoint", stackListCmd.Flags().Lookup("endpoint"))
|
||||
viper.BindPFlag("stack.list.format", stackListCmd.Flags().Lookup("format"))
|
||||
|
||||
stackListCmd.SetUsageTemplate(stackListCmd.UsageTemplate() + common.GetFormatHelp(portainer.Stack{}))
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import (
|
||||
"os"
|
||||
"text/template"
|
||||
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
|
||||
"github.com/greenled/portainer-stack-utils/common"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
@ -58,4 +60,6 @@ func init() {
|
||||
|
||||
statusCmd.Flags().String("format", "", "Format output using a Go template.")
|
||||
viper.BindPFlag("status.format", statusCmd.Flags().Lookup("format"))
|
||||
|
||||
statusCmd.SetUsageTemplate(statusCmd.UsageTemplate() + common.GetFormatHelp(portainer.Status{}))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user