From 9019d1b69eed029d22f48c77cc2ff042134d5317 Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 6 Feb 2025 16:05:30 -0500 Subject: [PATCH 01/15] add auto completion to desired flags --- cmd/completion/cmd.go | 74 +++++++++++++++++++ cmd/completion/cmd_test.go | 14 ++++ cmd/config/delete_profile.go | 9 +++ cmd/config/get.go | 15 ++-- cmd/config/set.go | 11 ++- cmd/config/set_active_profile.go | 9 +++ cmd/config/unset.go | 11 ++- cmd/config/view_profile.go | 9 +++ cmd/platform/export.go | 33 ++++++++- cmd/request/request.go | 24 ++++++ cmd/root.go | 29 +++++++- internal/commands/platform/export_internal.go | 2 +- 12 files changed, 226 insertions(+), 14 deletions(-) create mode 100644 cmd/completion/cmd.go create mode 100644 cmd/completion/cmd_test.go diff --git a/cmd/completion/cmd.go b/cmd/completion/cmd.go new file mode 100644 index 00000000..33907a7b --- /dev/null +++ b/cmd/completion/cmd.go @@ -0,0 +1,74 @@ +package completion + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +const ( + desc = `To load completions: + +Bash: + + $ source <(%[1]s completion bash) + + # To load completions for each session, execute once: + # Linux: + $ %[1]s completion bash > /etc/bash_completion.d/%[1]s + # macOS: + $ source <(%[1]s completion zsh) + +Zsh: + + # If shell completion is not already enabled in your environment, + # you will need to enable it. You can execute the following once: + + $ echo "autoload -U compinit; compinit" >> ~/.zshrc + + # To load completions for each session, execute once: + $ %[1]s completion zsh > "${fpath[1]}/_%[1]s" + + # You will need to start a new shell for this setup to take effect. + +fish: + + $ %[1]s completion fish | source + + # To load completions for each session, execute once: + $ %[1]s completion fish > ~/.config/fish/completions/%[1]s.fish + +PowerShell: + + PS> %[1]s completion powershell | Out-String | Invoke-Expression + + # To load completions for every new session, run: + PS> %[1]s completion powershell > %[1]s.ps1 + # and source this file from your PowerShell profile. +` +) + +func Command() *cobra.Command { + cmd := &cobra.Command{ + Use: "completion [SHELL]", + Short: "Prints shell completion scripts", + Long: fmt.Sprintf(desc, "pingcli"), + ValidArgs: []string{"bash", "zsh", "fish", "powershell"}, + Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), + RunE: func(cmd *cobra.Command, args []string) error { + switch args[0] { + case "bash": + _ = cmd.Root().GenBashCompletionV2(cmd.OutOrStdout(), true) + case "zsh": + _ = cmd.Root().GenZshCompletion(cmd.OutOrStdout()) + case "fish": + _ = cmd.Root().GenFishCompletion(cmd.OutOrStdout(), true) + case "powershell": + _ = cmd.Root().GenPowerShellCompletion(cmd.OutOrStdout()) + } + + return nil + }, + } + return cmd +} diff --git a/cmd/completion/cmd_test.go b/cmd/completion/cmd_test.go new file mode 100644 index 00000000..298d7a53 --- /dev/null +++ b/cmd/completion/cmd_test.go @@ -0,0 +1,14 @@ +package completion_test + +import ( + "testing" + + "github.com/pingidentity/pingcli/internal/testing/testutils" + "github.com/pingidentity/pingcli/internal/testing/testutils_cobra" +) + +// Test Completion Command Executes without issue +func TestCompletionCmd_Execute(t *testing.T) { + err := testutils_cobra.ExecutePingcli(t) + testutils.CheckExpectedError(t, err, nil) +} diff --git a/cmd/config/delete_profile.go b/cmd/config/delete_profile.go index 30c7525f..b28c288c 100644 --- a/cmd/config/delete_profile.go +++ b/cmd/config/delete_profile.go @@ -7,6 +7,7 @@ import ( config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/configuration/options" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/profiles" "github.com/spf13/cobra" ) @@ -32,6 +33,14 @@ The profile to delete will be removed from the CLI configuration file.`, RunE: configDeleteProfileRunE, Short: "Delete a custom configuration profile.", Use: "delete-profile [flags] [profile-name]", + // Auto-completion function to return all valid profile names + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + profileNames := profiles.GetMainConfig().ProfileNames() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + } + return profileNames, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }, } cmd.Flags().AddFlag(options.ConfigDeleteAutoAcceptOption.Flag) diff --git a/cmd/config/get.go b/cmd/config/get.go index e8e0c52b..f2885cbe 100644 --- a/cmd/config/get.go +++ b/cmd/config/get.go @@ -3,6 +3,7 @@ package config import ( "github.com/pingidentity/pingcli/cmd/common" config_internal "github.com/pingidentity/pingcli/internal/commands/config" + "github.com/pingidentity/pingcli/internal/configuration" "github.com/pingidentity/pingcli/internal/logger" "github.com/spf13/cobra" ) @@ -11,14 +12,17 @@ const ( configGetCommandExamples = ` Read all the configuration settings for the PingOne service in the active (or default) profile. pingcli config get pingone - Read the color setting for the profile named 'myProfile'. - pingcli config get --profile myProfile color + Read the noColor setting for the profile named 'myProfile'. + pingcli config get --profile myProfile noColor Read the worker ID used to authenticate to the PingOne service management API. pingcli config get service.pingone.authentication.worker.environmentID` ) func NewConfigGetCommand() *cobra.Command { + // Get viper keys for auto-completion in ValidArgs + viperKeys := configuration.ViperKeys() + cmd := &cobra.Command{ Args: common.ExactArgs(1), DisableFlagsInUseLine: true, // We write our own flags in @Use attribute @@ -26,9 +30,10 @@ func NewConfigGetCommand() *cobra.Command { Long: "Read stored configuration settings for the CLI.\n\n" + "The `--profile` parameter can be used to read configuration settings for a specified custom configuration profile.\n" + "Where `--profile` is not specified, configuration settings will be read for the currently active profile.", - RunE: configGetRunE, - Short: "Read stored configuration settings for the CLI.", - Use: "get [flags] key", + RunE: configGetRunE, + Short: "Read stored configuration settings for the CLI.", + Use: "get [flags] key", + ValidArgs: viperKeys, } return cmd diff --git a/cmd/config/set.go b/cmd/config/set.go index dea15f8b..6ad7a544 100644 --- a/cmd/config/set.go +++ b/cmd/config/set.go @@ -3,6 +3,7 @@ package config import ( "github.com/pingidentity/pingcli/cmd/common" config_internal "github.com/pingidentity/pingcli/internal/commands/config" + "github.com/pingidentity/pingcli/internal/configuration" "github.com/pingidentity/pingcli/internal/logger" "github.com/spf13/cobra" ) @@ -16,6 +17,9 @@ const ( ) func NewConfigSetCommand() *cobra.Command { + // Get viper keys for auto-completion in ValidArgs + viperKeys := configuration.ViperKeys() + cmd := &cobra.Command{ Args: common.ExactArgs(1), DisableFlagsInUseLine: true, // We write our own flags in @Use attribute @@ -23,9 +27,10 @@ func NewConfigSetCommand() *cobra.Command { Long: "Set stored configuration settings for the CLI.\n\n" + "The `--profile` parameter can be used to set configuration settings for a specified custom configuration profile.\n" + "Where `--profile` is not specified, configuration settings will be set for the currently active profile.", - RunE: configSetRunE, - Short: "Set stored configuration settings for the CLI.", - Use: "set [flags] key=value", + RunE: configSetRunE, + Short: "Set stored configuration settings for the CLI.", + Use: "set [flags] key=value", + ValidArgs: viperKeys, } return cmd diff --git a/cmd/config/set_active_profile.go b/cmd/config/set_active_profile.go index 669625c0..75b184b4 100644 --- a/cmd/config/set_active_profile.go +++ b/cmd/config/set_active_profile.go @@ -6,6 +6,7 @@ import ( "github.com/pingidentity/pingcli/cmd/common" config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/profiles" "github.com/spf13/cobra" ) @@ -26,6 +27,14 @@ func NewConfigSetActiveProfileCommand() *cobra.Command { RunE: configSetActiveProfileRunE, Short: "Set a custom configuration profile as the in-use profile.", Use: "set-active-profile [flags] [profile-name]", + // Auto-completion function to return all valid profile names + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + profileNames := profiles.GetMainConfig().ProfileNames() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + } + return profileNames, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }, } return cmd diff --git a/cmd/config/unset.go b/cmd/config/unset.go index 3cff854f..ddacb1f5 100644 --- a/cmd/config/unset.go +++ b/cmd/config/unset.go @@ -3,6 +3,7 @@ package config import ( "github.com/pingidentity/pingcli/cmd/common" config_internal "github.com/pingidentity/pingcli/internal/commands/config" + "github.com/pingidentity/pingcli/internal/configuration" "github.com/pingidentity/pingcli/internal/logger" "github.com/spf13/cobra" ) @@ -16,6 +17,9 @@ const ( ) func NewConfigUnsetCommand() *cobra.Command { + // Get viper keys for auto-completion in ValidArgs + viperKeys := configuration.ViperKeys() + cmd := &cobra.Command{ Args: common.ExactArgs(1), DisableFlagsInUseLine: true, // We write our own flags in @Use attribute @@ -23,9 +27,10 @@ func NewConfigUnsetCommand() *cobra.Command { Long: "Unset stored configuration settings for the CLI.\n\n" + "The `--profile` parameter can be used to unset configuration settings for a specified custom configuration profile.\n" + "Where `--profile` is not specified, configuration settings will be unset for the currently active profile.", - RunE: configUnsetRunE, - Short: "Unset stored configuration settings for the CLI.", - Use: "unset [flags] key", + RunE: configUnsetRunE, + Short: "Unset stored configuration settings for the CLI.", + Use: "unset [flags] key", + ValidArgs: viperKeys, } return cmd diff --git a/cmd/config/view_profile.go b/cmd/config/view_profile.go index 86b84bea..a87c2509 100644 --- a/cmd/config/view_profile.go +++ b/cmd/config/view_profile.go @@ -4,6 +4,7 @@ import ( "github.com/pingidentity/pingcli/cmd/common" config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/profiles" "github.com/spf13/cobra" ) @@ -24,6 +25,14 @@ func NewConfigViewProfileCommand() *cobra.Command { RunE: configViewProfileRunE, Short: "View the stored configuration of a custom configuration profile.", Use: "view-profile [flags] [profile-name]", + // Auto-completion function to return all valid profile names + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + profileNames := profiles.GetMainConfig().ProfileNames() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + } + return profileNames, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }, } return cmd diff --git a/cmd/platform/export.go b/cmd/platform/export.go index 521f32ff..729e8fee 100644 --- a/cmd/platform/export.go +++ b/cmd/platform/export.go @@ -4,6 +4,7 @@ import ( "github.com/pingidentity/pingcli/cmd/common" platform_internal "github.com/pingidentity/pingcli/internal/commands/platform" "github.com/pingidentity/pingcli/internal/configuration/options" + "github.com/pingidentity/pingcli/internal/customtypes" "github.com/pingidentity/pingcli/internal/logger" "github.com/spf13/cobra" ) @@ -16,7 +17,7 @@ const ( pingcli platform export --output-directory /path/to/my/directory --overwrite Export configuration-as-code packages for all configured products, specifying the export format as Terraform HCL. - pingcli platform export --export-format HCL + pingcli platform export --format HCL Export configuration-as-code packages for PingOne (core platform and SSO services). pingcli platform export --services pingone-platform,pingone-sso @@ -69,7 +70,19 @@ func exportRunE(cmd *cobra.Command, args []string) error { func initGeneralExportFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PlatformExportExportFormatOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validExportFormats := customtypes.ExportFormatValidValues() + return validExportFormats, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().AddFlag(options.PlatformExportServiceOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("services", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validServices := customtypes.ExportServicesValidValues() + return validServices, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().AddFlag(options.PlatformExportOutputDirectoryOption.Flag) cmd.Flags().AddFlag(options.PlatformExportOverwriteOption.Flag) cmd.Flags().AddFlag(options.PlatformExportPingOneEnvironmentIDOption.Flag) @@ -79,8 +92,20 @@ func initPingOneExportFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PingOneAuthenticationWorkerEnvironmentIDOption.Flag) cmd.Flags().AddFlag(options.PingOneAuthenticationWorkerClientIDOption.Flag) cmd.Flags().AddFlag(options.PingOneAuthenticationWorkerClientSecretOption.Flag) + cmd.Flags().AddFlag(options.PingOneRegionCodeOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("pingone-region-code", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validRegionCodes := customtypes.PingOneRegionCodeValidValues() + return validRegionCodes, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) + cmd.Flags().AddFlag(options.PingOneAuthenticationTypeOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("pingone-authentication-type", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validPingOneAuthTypes := customtypes.PingOneAuthenticationTypeValidValues() + return validPingOneAuthTypes, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) cmd.MarkFlagsRequiredTogether( options.PingOneAuthenticationWorkerEnvironmentIDOption.CobraParamName, @@ -102,7 +127,13 @@ func initPingFederateGeneralFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PingFederateXBypassExternalValidationHeaderOption.Flag) cmd.Flags().AddFlag(options.PingFederateCACertificatePemFilesOption.Flag) cmd.Flags().AddFlag(options.PingFederateInsecureTrustAllTLSOption.Flag) + cmd.Flags().AddFlag(options.PingFederateAuthenticationTypeOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("pingfederate-authentication-type", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validPingFedAuthTypes := customtypes.PingFederateAuthenticationTypeValidValues() + return validPingFedAuthTypes, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) } func initPingFederateBasicAuthFlags(cmd *cobra.Command) { diff --git a/cmd/request/request.go b/cmd/request/request.go index 385b640f..fe74ad33 100644 --- a/cmd/request/request.go +++ b/cmd/request/request.go @@ -4,6 +4,7 @@ import ( "github.com/pingidentity/pingcli/cmd/common" request_internal "github.com/pingidentity/pingcli/internal/commands/request" "github.com/pingidentity/pingcli/internal/configuration/options" + "github.com/pingidentity/pingcli/internal/customtypes" "github.com/pingidentity/pingcli/internal/logger" "github.com/spf13/cobra" ) @@ -39,9 +40,32 @@ The command offers a cURL-like experience to interact with the Ping platform ser Use: "request [flags] API_URI", } + // --http-method, -m cmd.Flags().AddFlag(options.RequestHTTPMethodOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("http-method", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validHTTPMethods := customtypes.HTTPMethodValidValues() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + } + return validHTTPMethods, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) + + // --service, -s cmd.Flags().AddFlag(options.RequestServiceOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("service", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validServices := customtypes.RequestServiceValidValues() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + } + return validServices, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) + + // --data cmd.Flags().AddFlag(options.RequestDataOption.Flag) + + // --fail, -f cmd.Flags().AddFlag(options.RequestFailOption.Flag) return cmd diff --git a/cmd/root.go b/cmd/root.go index 4addbda3..106074e9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,12 +5,14 @@ import ( "os" "path/filepath" + "github.com/pingidentity/pingcli/cmd/completion" "github.com/pingidentity/pingcli/cmd/config" "github.com/pingidentity/pingcli/cmd/feedback" "github.com/pingidentity/pingcli/cmd/platform" "github.com/pingidentity/pingcli/cmd/request" "github.com/pingidentity/pingcli/internal/configuration" "github.com/pingidentity/pingcli/internal/configuration/options" + "github.com/pingidentity/pingcli/internal/customtypes" "github.com/pingidentity/pingcli/internal/logger" "github.com/pingidentity/pingcli/internal/output" "github.com/pingidentity/pingcli/internal/profiles" @@ -40,17 +42,42 @@ func NewRootCommand(version string, commit string) *cobra.Command { cmd.AddCommand( // auth.NewAuthCommand(), + completion.Command(), config.NewConfigCommand(), feedback.NewFeedbackCommand(), platform.NewPlatformCommand(), request.NewRequestCommand(), ) + // FLAGS // + // --config, -C cmd.PersistentFlags().AddFlag(options.RootConfigOption.Flag) + + // --profile, -P cmd.PersistentFlags().AddFlag(options.RootProfileOption.Flag) - cmd.PersistentFlags().AddFlag(options.RootOutputFormatOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("profile", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validProfileNames := profiles.GetMainConfig().ProfileNames() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + } + return validProfileNames, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) + + // --no-color cmd.PersistentFlags().AddFlag(options.RootColorOption.Flag) + // --output-format, -O + cmd.PersistentFlags().AddFlag(options.RootOutputFormatOption.Flag) + // auto-completion + cmd.RegisterFlagCompletionFunc("output-format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validOutputFormats := customtypes.OutputFormatValidValues() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + } + return validOutputFormats, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp + }) + // Make sure cobra is outputting to stdout and stderr cmd.SetOut(os.Stdout) cmd.SetErr(os.Stderr) diff --git a/internal/commands/platform/export_internal.go b/internal/commands/platform/export_internal.go index d90a21f0..0fd62fb4 100644 --- a/internal/commands/platform/export_internal.go +++ b/internal/commands/platform/export_internal.go @@ -408,7 +408,7 @@ func getPingOneExportEnvID() (err error) { return err } if pingoneExportEnvID == "" { - return fmt.Errorf("failed to determine pingone export environment ID.") + return fmt.Errorf("failed to determine pingone export environment ID") } output.Warn("No target PingOne export environment ID specified. Defaulting export environment ID to the Worker App environment ID.", nil) From 817af89957ad6a1bdab40d172a36024f4c7def74 Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Fri, 14 Feb 2025 17:20:23 -0500 Subject: [PATCH 02/15] add autocompletion package, request data raw flag, documentation --- README.md | 2 + cmd/completion/cmd.go | 30 +++++----- cmd/config/delete_profile.go | 17 ++---- cmd/config/get.go | 5 +- cmd/config/set.go | 5 +- cmd/config/set_active_profile.go | 10 +--- cmd/config/unset.go | 5 +- cmd/config/view_profile.go | 10 +--- cmd/platform/export.go | 53 +++++++++------- cmd/request/request.go | 60 +++++++++++-------- cmd/root.go | 28 ++++----- docs/autocompletion/autocompletion.md | 37 ++++++++++++ internal/autocompletion/config/config_args.go | 38 ++++++++++++ .../autocompletion/platform/export_flags.go | 31 ++++++++++ .../autocompletion/request/request_flags.go | 29 +++++++++ internal/autocompletion/root_flags.go | 23 +++++++ internal/commands/request/request_internal.go | 26 ++++---- internal/configuration/options/options.go | 2 + internal/configuration/request/request.go | 28 ++++++++- 19 files changed, 310 insertions(+), 129 deletions(-) create mode 100644 docs/autocompletion/autocompletion.md create mode 100644 internal/autocompletion/config/config_args.go create mode 100644 internal/autocompletion/platform/export_flags.go create mode 100644 internal/autocompletion/request/request_flags.go create mode 100644 internal/autocompletion/root_flags.go diff --git a/README.md b/README.md index a1c5aef7..3c83077e 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,8 @@ The newly create profile can now be configured via the `pingcli config set` comm See [Configuration Key Documentation](./docs/tool-configuration/configuration-key.md) for more information on configuration keys and their purposes. +See [Autocompletion Documentation](./docs/autocompletion/autocompletion.md) for information on loading autocompletion for select command flags. + ## Commands Ping CLI commands have the following structure: diff --git a/cmd/completion/cmd.go b/cmd/completion/cmd.go index 33907a7b..17196524 100644 --- a/cmd/completion/cmd.go +++ b/cmd/completion/cmd.go @@ -48,6 +48,21 @@ PowerShell: ` ) +func completionCmdRunE(cmd *cobra.Command, args []string) error { + switch args[0] { + case "bash": + _ = cmd.Root().GenBashCompletionV2(cmd.OutOrStdout(), true) + case "zsh": + _ = cmd.Root().GenZshCompletion(cmd.OutOrStdout()) + case "fish": + _ = cmd.Root().GenFishCompletion(cmd.OutOrStdout(), true) + case "powershell": + _ = cmd.Root().GenPowerShellCompletion(cmd.OutOrStdout()) + } + + return nil +} + func Command() *cobra.Command { cmd := &cobra.Command{ Use: "completion [SHELL]", @@ -55,20 +70,7 @@ func Command() *cobra.Command { Long: fmt.Sprintf(desc, "pingcli"), ValidArgs: []string{"bash", "zsh", "fish", "powershell"}, Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), - RunE: func(cmd *cobra.Command, args []string) error { - switch args[0] { - case "bash": - _ = cmd.Root().GenBashCompletionV2(cmd.OutOrStdout(), true) - case "zsh": - _ = cmd.Root().GenZshCompletion(cmd.OutOrStdout()) - case "fish": - _ = cmd.Root().GenFishCompletion(cmd.OutOrStdout(), true) - case "powershell": - _ = cmd.Root().GenPowerShellCompletion(cmd.OutOrStdout()) - } - - return nil - }, + RunE: completionCmdRunE, } return cmd } diff --git a/cmd/config/delete_profile.go b/cmd/config/delete_profile.go index b28c288c..2e0ca5a7 100644 --- a/cmd/config/delete_profile.go +++ b/cmd/config/delete_profile.go @@ -4,10 +4,10 @@ import ( "os" "github.com/pingidentity/pingcli/cmd/common" + autocompletion_config_args "github.com/pingidentity/pingcli/internal/autocompletion/config" config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/configuration/options" "github.com/pingidentity/pingcli/internal/logger" - "github.com/pingidentity/pingcli/internal/profiles" "github.com/spf13/cobra" ) @@ -30,17 +30,10 @@ func NewConfigDeleteProfileCommand() *cobra.Command { Long: `Delete an existing custom configuration profile from the CLI. The profile to delete will be removed from the CLI configuration file.`, - RunE: configDeleteProfileRunE, - Short: "Delete a custom configuration profile.", - Use: "delete-profile [flags] [profile-name]", - // Auto-completion function to return all valid profile names - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - profileNames := profiles.GetMainConfig().ProfileNames() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - } - return profileNames, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }, + RunE: configDeleteProfileRunE, + Short: "Delete a custom configuration profile.", + Use: "delete-profile [flags] [profile-name]", + ValidArgsFunction: autocompletion_config_args.ReturnNonActiveProfiles, } cmd.Flags().AddFlag(options.ConfigDeleteAutoAcceptOption.Flag) diff --git a/cmd/config/get.go b/cmd/config/get.go index f2885cbe..65d37b38 100644 --- a/cmd/config/get.go +++ b/cmd/config/get.go @@ -20,9 +20,6 @@ const ( ) func NewConfigGetCommand() *cobra.Command { - // Get viper keys for auto-completion in ValidArgs - viperKeys := configuration.ViperKeys() - cmd := &cobra.Command{ Args: common.ExactArgs(1), DisableFlagsInUseLine: true, // We write our own flags in @Use attribute @@ -33,7 +30,7 @@ func NewConfigGetCommand() *cobra.Command { RunE: configGetRunE, Short: "Read stored configuration settings for the CLI.", Use: "get [flags] key", - ValidArgs: viperKeys, + ValidArgs: configuration.ViperKeys(), } return cmd diff --git a/cmd/config/set.go b/cmd/config/set.go index 6ad7a544..d89f9473 100644 --- a/cmd/config/set.go +++ b/cmd/config/set.go @@ -17,9 +17,6 @@ const ( ) func NewConfigSetCommand() *cobra.Command { - // Get viper keys for auto-completion in ValidArgs - viperKeys := configuration.ViperKeys() - cmd := &cobra.Command{ Args: common.ExactArgs(1), DisableFlagsInUseLine: true, // We write our own flags in @Use attribute @@ -30,7 +27,7 @@ func NewConfigSetCommand() *cobra.Command { RunE: configSetRunE, Short: "Set stored configuration settings for the CLI.", Use: "set [flags] key=value", - ValidArgs: viperKeys, + ValidArgs: configuration.ViperKeys(), } return cmd diff --git a/cmd/config/set_active_profile.go b/cmd/config/set_active_profile.go index 75b184b4..fe9193ae 100644 --- a/cmd/config/set_active_profile.go +++ b/cmd/config/set_active_profile.go @@ -4,9 +4,9 @@ import ( "os" "github.com/pingidentity/pingcli/cmd/common" + autocompletion_config_args "github.com/pingidentity/pingcli/internal/autocompletion/config" config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/logger" - "github.com/pingidentity/pingcli/internal/profiles" "github.com/spf13/cobra" ) @@ -28,13 +28,7 @@ func NewConfigSetActiveProfileCommand() *cobra.Command { Short: "Set a custom configuration profile as the in-use profile.", Use: "set-active-profile [flags] [profile-name]", // Auto-completion function to return all valid profile names - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - profileNames := profiles.GetMainConfig().ProfileNames() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - } - return profileNames, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }, + ValidArgsFunction: autocompletion_config_args.ReturnNonActiveProfiles, } return cmd diff --git a/cmd/config/unset.go b/cmd/config/unset.go index ddacb1f5..e3ce5674 100644 --- a/cmd/config/unset.go +++ b/cmd/config/unset.go @@ -17,9 +17,6 @@ const ( ) func NewConfigUnsetCommand() *cobra.Command { - // Get viper keys for auto-completion in ValidArgs - viperKeys := configuration.ViperKeys() - cmd := &cobra.Command{ Args: common.ExactArgs(1), DisableFlagsInUseLine: true, // We write our own flags in @Use attribute @@ -30,7 +27,7 @@ func NewConfigUnsetCommand() *cobra.Command { RunE: configUnsetRunE, Short: "Unset stored configuration settings for the CLI.", Use: "unset [flags] key", - ValidArgs: viperKeys, + ValidArgs: configuration.ViperKeys(), } return cmd diff --git a/cmd/config/view_profile.go b/cmd/config/view_profile.go index a87c2509..489b347b 100644 --- a/cmd/config/view_profile.go +++ b/cmd/config/view_profile.go @@ -2,9 +2,9 @@ package config import ( "github.com/pingidentity/pingcli/cmd/common" + autocompletion_config_args "github.com/pingidentity/pingcli/internal/autocompletion/config" config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/logger" - "github.com/pingidentity/pingcli/internal/profiles" "github.com/spf13/cobra" ) @@ -26,13 +26,7 @@ func NewConfigViewProfileCommand() *cobra.Command { Short: "View the stored configuration of a custom configuration profile.", Use: "view-profile [flags] [profile-name]", // Auto-completion function to return all valid profile names - ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - profileNames := profiles.GetMainConfig().ProfileNames() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - } - return profileNames, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }, + ValidArgsFunction: autocompletion_config_args.ViewProfile, } return cmd diff --git a/cmd/platform/export.go b/cmd/platform/export.go index 729e8fee..3e117f48 100644 --- a/cmd/platform/export.go +++ b/cmd/platform/export.go @@ -1,11 +1,14 @@ package platform import ( + "fmt" + "github.com/pingidentity/pingcli/cmd/common" + autocompletion_export_flags "github.com/pingidentity/pingcli/internal/autocompletion/platform" platform_internal "github.com/pingidentity/pingcli/internal/commands/platform" "github.com/pingidentity/pingcli/internal/configuration/options" - "github.com/pingidentity/pingcli/internal/customtypes" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/output" "github.com/spf13/cobra" ) @@ -35,6 +38,10 @@ const ( pingcli platform export --services pingfederate --x-bypass-external-validation=false --ca-certificate-pem-files "/path/to/cert.pem,/path/to/cert2.pem" --insecure-trust-all-tls=false` ) +func returnExportSystemError(err error) { + output.SystemError(fmt.Sprintf("Unable to register auto completion for export flag: %v", err), nil) +} + func NewExportCommand() *cobra.Command { cmd := &cobra.Command{ Args: common.ExactArgs(0), @@ -71,17 +78,17 @@ func exportRunE(cmd *cobra.Command, args []string) error { func initGeneralExportFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PlatformExportExportFormatOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validExportFormats := customtypes.ExportFormatValidValues() - return validExportFormats, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) + err := cmd.RegisterFlagCompletionFunc("format", autocompletion_export_flags.Format) + if err != nil { + returnExportSystemError(err) + } cmd.Flags().AddFlag(options.PlatformExportServiceOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("services", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validServices := customtypes.ExportServicesValidValues() - return validServices, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) + err = cmd.RegisterFlagCompletionFunc("services", autocompletion_export_flags.Services) + if err != nil { + returnExportSystemError(err) + } cmd.Flags().AddFlag(options.PlatformExportOutputDirectoryOption.Flag) cmd.Flags().AddFlag(options.PlatformExportOverwriteOption.Flag) @@ -93,19 +100,19 @@ func initPingOneExportFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PingOneAuthenticationWorkerClientIDOption.Flag) cmd.Flags().AddFlag(options.PingOneAuthenticationWorkerClientSecretOption.Flag) - cmd.Flags().AddFlag(options.PingOneRegionCodeOption.Flag) + cmd.Flags().AddFlag(options.PingOneAuthenticationTypeOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("pingone-region-code", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validRegionCodes := customtypes.PingOneRegionCodeValidValues() - return validRegionCodes, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) + err := cmd.RegisterFlagCompletionFunc("pingone-authentication-type", autocompletion_export_flags.PingOneAuthenticationType) + if err != nil { + returnExportSystemError(err) + } - cmd.Flags().AddFlag(options.PingOneAuthenticationTypeOption.Flag) + cmd.Flags().AddFlag(options.PingOneRegionCodeOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("pingone-authentication-type", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validPingOneAuthTypes := customtypes.PingOneAuthenticationTypeValidValues() - return validPingOneAuthTypes, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) + err = cmd.RegisterFlagCompletionFunc("pingone-region-code", autocompletion_export_flags.PingOneRegionCode) + if err != nil { + returnExportSystemError(err) + } cmd.MarkFlagsRequiredTogether( options.PingOneAuthenticationWorkerEnvironmentIDOption.CobraParamName, @@ -130,10 +137,10 @@ func initPingFederateGeneralFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PingFederateAuthenticationTypeOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("pingfederate-authentication-type", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validPingFedAuthTypes := customtypes.PingFederateAuthenticationTypeValidValues() - return validPingFedAuthTypes, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) + err := cmd.RegisterFlagCompletionFunc("pingfederate-authentication-type", autocompletion_export_flags.PingFederateAuthenticationType) + if err != nil { + returnExportSystemError(err) + } } func initPingFederateBasicAuthFlags(cmd *cobra.Command) { diff --git a/cmd/request/request.go b/cmd/request/request.go index fe74ad33..bcf1e92b 100644 --- a/cmd/request/request.go +++ b/cmd/request/request.go @@ -1,11 +1,14 @@ package request import ( + "fmt" + "github.com/pingidentity/pingcli/cmd/common" + autocompletion_request_flags "github.com/pingidentity/pingcli/internal/autocompletion/request" request_internal "github.com/pingidentity/pingcli/internal/commands/request" "github.com/pingidentity/pingcli/internal/configuration/options" - "github.com/pingidentity/pingcli/internal/customtypes" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/output" "github.com/spf13/cobra" ) @@ -15,17 +18,21 @@ const ( Send a custom API request to the configured PingOne tenant, making a GET request to retrieve JSON configuration for a specific environment. pingcli request --service pingone --http-method GET --output-format json environments/$MY_ENVIRONMENT_ID + + Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment with JSON data sourced from a file. + pingcli request --service pingone --http-method POST --data @./my-environment.json environments - Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment using raw JSON data. - pingcli request --service pingone --http-method POST --data '{"name": "My environment"}' environments - - Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment with JSON data sourced from a file. - pingcli request --service pingone --http-method POST --data @./my-environment.json environments + Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment using raw JSON data. + pingcli request --service pingone --http-method POST --data-raw '{"name": "My environment"}' environments Send a custom API request to the configured PingOne tenant, making a DELETE request to remove an application attribute mapping. pingcli request --service pingone --http-method DELETE environments/$MY_ENVIRONMENT_ID/applications/$MY_APPLICATION_ID/attributes/$MY_ATTRIBUTE_MAPPING_ID` ) +func returnServiceSystemError(err error) { + output.SystemError(fmt.Sprintf("Unable to register auto completion for service flag: %v", err), nil) +} + func NewRequestCommand() *cobra.Command { cmd := &cobra.Command{ Args: common.ExactArgs(1), @@ -40,33 +47,36 @@ The command offers a cURL-like experience to interact with the Ping platform ser Use: "request [flags] API_URI", } + // --data + // auto-completion + cmd.Flags().AddFlag(options.RequestDataOption.Flag) + err := cmd.RegisterFlagCompletionFunc("data", autocompletion_request_flags.Data) + if err != nil { + returnServiceSystemError(err) + } + + // --data-raw + cmd.Flags().AddFlag(options.RequestDataRawOption.Flag) + + // --fail, -f + cmd.Flags().AddFlag(options.RequestFailOption.Flag) + // --http-method, -m cmd.Flags().AddFlag(options.RequestHTTPMethodOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("http-method", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validHTTPMethods := customtypes.HTTPMethodValidValues() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - } - return validHTTPMethods, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) + err = cmd.RegisterFlagCompletionFunc("http-method", autocompletion_request_flags.HTTPMethod) + if err != nil { + returnServiceSystemError(err) + } // --service, -s cmd.Flags().AddFlag(options.RequestServiceOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("service", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validServices := customtypes.RequestServiceValidValues() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - } - return validServices, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) - - // --data - cmd.Flags().AddFlag(options.RequestDataOption.Flag) + err = cmd.RegisterFlagCompletionFunc("service", autocompletion_request_flags.Service) - // --fail, -f - cmd.Flags().AddFlag(options.RequestFailOption.Flag) + if err != nil { + returnServiceSystemError(err) + } return cmd } diff --git a/cmd/root.go b/cmd/root.go index 106074e9..57e1c665 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -10,9 +10,9 @@ import ( "github.com/pingidentity/pingcli/cmd/feedback" "github.com/pingidentity/pingcli/cmd/platform" "github.com/pingidentity/pingcli/cmd/request" + autocompletion_root_flags "github.com/pingidentity/pingcli/internal/autocompletion" "github.com/pingidentity/pingcli/internal/configuration" "github.com/pingidentity/pingcli/internal/configuration/options" - "github.com/pingidentity/pingcli/internal/customtypes" "github.com/pingidentity/pingcli/internal/logger" "github.com/pingidentity/pingcli/internal/output" "github.com/pingidentity/pingcli/internal/profiles" @@ -30,6 +30,10 @@ func init() { cobra.OnInitialize(initViperProfile) } +func returnRootSystemError(err error) { + output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli flag: %v", err), nil) +} + // rootCmd represents the base command when called without any subcommands func NewRootCommand(version string, commit string) *cobra.Command { cmd := &cobra.Command{ @@ -56,13 +60,10 @@ func NewRootCommand(version string, commit string) *cobra.Command { // --profile, -P cmd.PersistentFlags().AddFlag(options.RootProfileOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("profile", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validProfileNames := profiles.GetMainConfig().ProfileNames() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - } - return validProfileNames, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) + err := cmd.RegisterFlagCompletionFunc("profile", autocompletion_root_flags.Profile) + if err != nil { + returnRootSystemError(err) + } // --no-color cmd.PersistentFlags().AddFlag(options.RootColorOption.Flag) @@ -70,13 +71,10 @@ func NewRootCommand(version string, commit string) *cobra.Command { // --output-format, -O cmd.PersistentFlags().AddFlag(options.RootOutputFormatOption.Flag) // auto-completion - cmd.RegisterFlagCompletionFunc("output-format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validOutputFormats := customtypes.OutputFormatValidValues() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - } - return validOutputFormats, cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp - }) + err = cmd.RegisterFlagCompletionFunc("output-format", autocompletion_root_flags.OutputFormat) + if err != nil { + returnRootSystemError(err) + } // Make sure cobra is outputting to stdout and stderr cmd.SetOut(os.Stdout) diff --git a/docs/autocompletion/autocompletion.md b/docs/autocompletion/autocompletion.md new file mode 100644 index 00000000..1ef85a0d --- /dev/null +++ b/docs/autocompletion/autocompletion.md @@ -0,0 +1,37 @@ +# Autocompletion Configuration +## To load autocompletion for select command flags, run the applicable command for your environment. + +## Bash: + ### To load completions for one session, execute: + `$ source <(pingcli completion bash)` + + ### To load completions for every future session, execute once: + #### Linux: + `$ pingcli completion bash > /etc/bash_completion.d/pingcli` + #### macOS: + `$ pingcli completion bash > $(brew --prefix)/etc/bash_completion.d/pingcli` + +## Zsh: + ### If shell completion is not already enabled in your environment, + ### you will need to enable it. You can execute the following once: + `$ echo "autoload -U compinit; compinit" >> ~/.zshrc` + + ### To load completions for every future session, execute once: + `$ pingcli completion zsh > "${fpath[1]}/_pingcli"` + + ### You will need to start a new shell for this setup to take effect. + +## fish: + ### To load completions for one session, execute: + `$ pingcli completion fish | source` + + ### To load completions for every future session, execute once: + `$ pingcli completion fish > ~/.config/fish/completions/pingcli.fish` + +## PowerShell: + ### To load completions for one session, execute: + `PS> pingcli completion powershell | Out-String | Invoke-Expression` + + ### To load completions for every future session: + `PS> pingcli completion powershell > pingcli.ps1` + ### then source this file from your PowerShell profile \ No newline at end of file diff --git a/internal/autocompletion/config/config_args.go b/internal/autocompletion/config/config_args.go new file mode 100644 index 00000000..cf49eba6 --- /dev/null +++ b/internal/autocompletion/config/config_args.go @@ -0,0 +1,38 @@ +package autocompletion_config_args + +import ( + "fmt" + + "github.com/pingidentity/pingcli/internal/configuration/options" + "github.com/pingidentity/pingcli/internal/output" + "github.com/pingidentity/pingcli/internal/profiles" + "github.com/spf13/cobra" +) + +func ViewProfile(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + profileNames := profiles.GetMainConfig().ProfileNames() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoFileComp + } + return profileNames, cobra.ShellCompDirectiveNoFileComp +} + +func ReturnNonActiveProfiles(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + profileNames := profiles.GetMainConfig().ProfileNames() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoFileComp + } + + activeProfileName, err := profiles.GetOptionValue(options.RootActiveProfileOption) + if err != nil { + output.SystemError(fmt.Sprintf("Unable to get active profile: %v", err), nil) + } + + nonActiveProfiles := []string{} + for _, p := range profileNames { + if p != activeProfileName { + nonActiveProfiles = append(nonActiveProfiles, p) + } + } + return nonActiveProfiles, cobra.ShellCompDirectiveNoFileComp +} diff --git a/internal/autocompletion/platform/export_flags.go b/internal/autocompletion/platform/export_flags.go new file mode 100644 index 00000000..50308d3a --- /dev/null +++ b/internal/autocompletion/platform/export_flags.go @@ -0,0 +1,31 @@ +package autocompletion_export_flags + +import ( + "github.com/pingidentity/pingcli/internal/customtypes" + "github.com/spf13/cobra" +) + +func Format(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validExportFormats := customtypes.ExportFormatValidValues() + return validExportFormats, cobra.ShellCompDirectiveNoFileComp +} + +func PingFederateAuthenticationType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validPingFedAuthTypes := customtypes.PingFederateAuthenticationTypeValidValues() + return validPingFedAuthTypes, cobra.ShellCompDirectiveNoFileComp +} + +func PingOneAuthenticationType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validPingOneAuthTypes := customtypes.PingOneAuthenticationTypeValidValues() + return validPingOneAuthTypes, cobra.ShellCompDirectiveNoFileComp +} + +func PingOneRegionCode(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validRegionCodes := customtypes.PingOneRegionCodeValidValues() + return validRegionCodes, cobra.ShellCompDirectiveNoFileComp +} + +func Services(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validServices := customtypes.ExportServicesValidValues() + return validServices, cobra.ShellCompDirectiveNoFileComp +} diff --git a/internal/autocompletion/request/request_flags.go b/internal/autocompletion/request/request_flags.go new file mode 100644 index 00000000..053a02cc --- /dev/null +++ b/internal/autocompletion/request/request_flags.go @@ -0,0 +1,29 @@ +package autocompletion_request_flags + +import ( + "github.com/pingidentity/pingcli/internal/customtypes" + "github.com/spf13/cobra" +) + +func Data(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + if len(toComplete) != 0 { + return nil, cobra.ShellCompDirectiveDefault + } + return nil, cobra.ShellCompDirectiveNoFileComp +} + +func HTTPMethod(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validHTTPMethods := customtypes.HTTPMethodValidValues() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoFileComp + } + return validHTTPMethods, cobra.ShellCompDirectiveNoFileComp +} + +func Service(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validServices := customtypes.RequestServiceValidValues() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoFileComp + } + return validServices, cobra.ShellCompDirectiveNoFileComp +} diff --git a/internal/autocompletion/root_flags.go b/internal/autocompletion/root_flags.go new file mode 100644 index 00000000..61cb4fa9 --- /dev/null +++ b/internal/autocompletion/root_flags.go @@ -0,0 +1,23 @@ +package autocompletion_root_flags + +import ( + "github.com/pingidentity/pingcli/internal/customtypes" + "github.com/pingidentity/pingcli/internal/profiles" + "github.com/spf13/cobra" +) + +func Profile(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validProfileNames := profiles.GetMainConfig().ProfileNames() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoFileComp + } + return validProfileNames, cobra.ShellCompDirectiveNoFileComp +} + +func OutputFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + validOutputFormats := customtypes.OutputFormatValidValues() + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoFileComp + } + return validOutputFormats, cobra.ShellCompDirectiveNoFileComp +} diff --git a/internal/commands/request/request_internal.go b/internal/commands/request/request_internal.go index f36b2a2c..72c00fe8 100644 --- a/internal/commands/request/request_internal.go +++ b/internal/commands/request/request_internal.go @@ -280,25 +280,31 @@ func pingoneAuth() (accessToken string, err error) { } func getData() (data string, err error) { - data, err = profiles.GetOptionValue(options.RequestDataOption) + data, err = profiles.GetOptionValue(options.RequestDataRawOption) if err != nil { return "", err } + if data != "" { + return data, nil + } - if data == "" { - return "", nil + data, err = profiles.GetOptionValue(options.RequestDataOption) + if err != nil { + return "", err } // if data string first character is '@', read from file - if strings.HasPrefix(data, "@") { - filePath := strings.TrimPrefix(data, "@") + if data != "" { + if strings.HasPrefix(data, "@") { + filePath := strings.TrimPrefix(data, "@") - contents, err := os.ReadFile(filePath) - if err != nil { - return "", err - } + contents, err := os.ReadFile(filePath) + if err != nil { + return "", err + } - data = string(contents) + data = string(contents) + } } return data, nil diff --git a/internal/configuration/options/options.go b/internal/configuration/options/options.go index fa57bb59..64005ece 100644 --- a/internal/configuration/options/options.go +++ b/internal/configuration/options/options.go @@ -80,6 +80,7 @@ func Options() []Option { ConfigListKeysYamlOption, RequestDataOption, + RequestDataRawOption, RequestHTTPMethodOption, RequestServiceOption, RequestAccessTokenOption, @@ -158,6 +159,7 @@ var ( // 'pingcli request' command options var ( RequestDataOption Option + RequestDataRawOption Option RequestHTTPMethodOption Option RequestServiceOption Option RequestAccessTokenOption Option diff --git a/internal/configuration/request/request.go b/internal/configuration/request/request.go index 38f35b4a..800fc1e9 100644 --- a/internal/configuration/request/request.go +++ b/internal/configuration/request/request.go @@ -11,6 +11,7 @@ import ( func InitRequestOptions() { initDataOption() + initDataRawOption() initHTTPMethodOption() initServiceOption() initAccessTokenOption() @@ -31,8 +32,31 @@ func initDataOption() { EnvVar: envVar, Flag: &pflag.Flag{ Name: cobraParamName, - Usage: "The data to send in the request. Use prefix '@' to specify data file path instead of raw data. " + - "\nExample: '@data.json'", + Usage: "The file containing data to send in the request. " + + "\nExample: './data.json'", + Value: cobraValue, + }, + Sensitive: false, + Type: options.ENUM_STRING, + ViperKey: "", // No viper key + } +} + +func initDataRawOption() { + cobraParamName := "data-raw" + cobraValue := new(customtypes.String) + defaultValue := customtypes.String("") + envVar := "PINGCLI_REQUEST_DATA_RAW" + + options.RequestDataRawOption = options.Option{ + CobraParamName: cobraParamName, + CobraParamValue: cobraValue, + DefaultValue: &defaultValue, + EnvVar: envVar, + Flag: &pflag.Flag{ + Name: cobraParamName, + Usage: "The raw data to send in the request. " + + "\nExample: '{\"name\": \"My environment\"}'", Value: cobraValue, }, Sensitive: false, From 4194f1118ee9f0ccd0cf5935ec93712915562c63 Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 20 Feb 2025 11:12:23 -0500 Subject: [PATCH 03/15] re-init all flag options when capturing cobra output during testing, remove nonneeded data autocompletion, update package name --- cmd/request/request.go | 7 +------ internal/autocompletion/request/request_flags.go | 7 ------- internal/autocompletion/root_flags.go | 2 +- internal/testing/testutils_cobra/cobra_utils.go | 3 +++ 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/cmd/request/request.go b/cmd/request/request.go index bcf1e92b..9fcd2ac0 100644 --- a/cmd/request/request.go +++ b/cmd/request/request.go @@ -48,12 +48,7 @@ The command offers a cURL-like experience to interact with the Ping platform ser } // --data - // auto-completion cmd.Flags().AddFlag(options.RequestDataOption.Flag) - err := cmd.RegisterFlagCompletionFunc("data", autocompletion_request_flags.Data) - if err != nil { - returnServiceSystemError(err) - } // --data-raw cmd.Flags().AddFlag(options.RequestDataRawOption.Flag) @@ -64,7 +59,7 @@ The command offers a cURL-like experience to interact with the Ping platform ser // --http-method, -m cmd.Flags().AddFlag(options.RequestHTTPMethodOption.Flag) // auto-completion - err = cmd.RegisterFlagCompletionFunc("http-method", autocompletion_request_flags.HTTPMethod) + err := cmd.RegisterFlagCompletionFunc("http-method", autocompletion_request_flags.HTTPMethod) if err != nil { returnServiceSystemError(err) } diff --git a/internal/autocompletion/request/request_flags.go b/internal/autocompletion/request/request_flags.go index 053a02cc..2d562386 100644 --- a/internal/autocompletion/request/request_flags.go +++ b/internal/autocompletion/request/request_flags.go @@ -5,13 +5,6 @@ import ( "github.com/spf13/cobra" ) -func Data(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - if len(toComplete) != 0 { - return nil, cobra.ShellCompDirectiveDefault - } - return nil, cobra.ShellCompDirectiveNoFileComp -} - func HTTPMethod(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { validHTTPMethods := customtypes.HTTPMethodValidValues() if len(args) != 0 { diff --git a/internal/autocompletion/root_flags.go b/internal/autocompletion/root_flags.go index 61cb4fa9..5ee6debc 100644 --- a/internal/autocompletion/root_flags.go +++ b/internal/autocompletion/root_flags.go @@ -1,4 +1,4 @@ -package autocompletion_root_flags +package autocompletion import ( "github.com/pingidentity/pingcli/internal/customtypes" diff --git a/internal/testing/testutils_cobra/cobra_utils.go b/internal/testing/testutils_cobra/cobra_utils.go index 14fd42e8..c06368cf 100644 --- a/internal/testing/testutils_cobra/cobra_utils.go +++ b/internal/testing/testutils_cobra/cobra_utils.go @@ -36,6 +36,9 @@ func ExecutePingcli(t *testing.T, args ...string) (err error) { func ExecutePingcliCaptureCobraOutput(t *testing.T, args ...string) (output string, err error) { t.Helper() + // Reset options for testing individual executions of pingcli + configuration.InitAllOptions() + root := cmd.NewRootCommand("test-version", "test-commit") // Add config location to the root command From 6b2834e809e9a5d0ec5a0ecba5b6f42ba429b3b0 Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 20 Feb 2025 11:50:04 -0500 Subject: [PATCH 04/15] update go to version 1.24 --- go.mod | 97 ++++++++++---------- go.sum | 199 +++++++++++++++++++--------------------- internal/tools/tools.go | 12 --- 3 files changed, 145 insertions(+), 163 deletions(-) delete mode 100644 internal/tools/tools.go diff --git a/go.mod b/go.mod index aa592975..62f0754d 100644 --- a/go.mod +++ b/go.mod @@ -1,34 +1,37 @@ module github.com/pingidentity/pingcli -go 1.23.3 +go 1.24.0 + +tool ( + github.com/golangci/golangci-lint/cmd/golangci-lint + github.com/pavius/impi +) require ( github.com/fatih/color v1.18.0 - github.com/golangci/golangci-lint v1.63.2 github.com/hashicorp/go-uuid v1.0.3 github.com/manifoldco/promptui v0.9.0 - github.com/patrickcping/pingone-go-sdk-v2 v0.12.5 - github.com/patrickcping/pingone-go-sdk-v2/management v0.45.0 - github.com/patrickcping/pingone-go-sdk-v2/risk v0.18.0 - github.com/pavius/impi v0.0.3 + github.com/patrickcping/pingone-go-sdk-v2 v0.12.9 + github.com/patrickcping/pingone-go-sdk-v2/management v0.49.0 + github.com/patrickcping/pingone-go-sdk-v2/risk v0.19.0 github.com/pingidentity/pingfederate-go-client/v1210 v1210.0.5 github.com/rs/zerolog v1.33.0 - github.com/spf13/cobra v1.8.1 - github.com/spf13/pflag v1.0.5 + github.com/spf13/cobra v1.9.1 + github.com/spf13/pflag v1.0.6 github.com/spf13/viper v1.19.0 gopkg.in/yaml.v3 v3.0.1 ) require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect - 4d63.com/gochecknoglobals v0.2.1 // indirect + 4d63.com/gochecknoglobals v0.2.2 // indirect github.com/4meepo/tagalign v1.4.1 // indirect github.com/Abirdcfly/dupword v0.1.3 // indirect github.com/Antonboom/errname v1.0.0 // indirect github.com/Antonboom/nilnil v1.0.1 // indirect github.com/Antonboom/testifylint v1.5.2 // indirect github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect - github.com/Crocmagnon/fatcontext v0.5.3 // indirect + github.com/Crocmagnon/fatcontext v0.7.1 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Masterminds/semver/v3 v3.3.1 // indirect @@ -37,7 +40,7 @@ require ( github.com/alexkohler/nakedret/v2 v2.0.5 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/alingse/nilnesserr v0.1.1 // indirect + github.com/alingse/nilnesserr v0.1.2 // indirect github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -48,7 +51,7 @@ require ( github.com/breml/errchkjson v0.4.0 // indirect github.com/butuzov/ireturn v0.3.1 // indirect github.com/butuzov/mirror v1.3.0 // indirect - github.com/catenacyber/perfsprint v0.7.1 // indirect + github.com/catenacyber/perfsprint v0.8.1 // indirect github.com/ccojocar/zxcvbn-go v1.0.2 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect @@ -64,8 +67,8 @@ require ( github.com/firefart/nonamedreturns v1.0.5 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/ghostiam/protogetter v0.3.8 // indirect - github.com/go-critic/go-critic v0.11.5 // indirect + github.com/ghostiam/protogetter v0.3.9 // indirect + github.com/go-critic/go-critic v0.12.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.2.0 // indirect @@ -79,16 +82,17 @@ require ( github.com/gofrs/flock v0.12.1 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-printf-func-name v0.1.0 // indirect - github.com/golangci/gofmt v0.0.0-20241223200906-057b0627d9b9 // indirect + github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect + github.com/golangci/golangci-lint v1.64.5 // indirect github.com/golangci/misspell v0.6.0 // indirect github.com/golangci/plugin-module-register v0.1.1 // indirect - github.com/golangci/revgrep v0.5.3 // indirect + github.com/golangci/revgrep v0.8.0 // indirect github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/gordonklaus/ineffassign v0.1.0 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.5.0 // indirect - github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect + github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect github.com/gostaticanalysis/nilerr v0.1.1 // indirect github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect @@ -100,29 +104,28 @@ require ( github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jjti/go-spancheck v0.6.4 // indirect github.com/julz/importas v0.2.0 // indirect - github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect + github.com/karamaru-alpha/copyloopvar v1.2.1 // indirect github.com/kisielk/errcheck v1.8.0 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.5 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.10 // indirect - github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/lasiar/canonicalheader v1.1.2 // indirect - github.com/ldez/exptostd v0.3.0 // indirect - github.com/ldez/gomoddirectives v0.6.0 // indirect - github.com/ldez/grignotin v0.7.0 // indirect + github.com/ldez/exptostd v0.4.1 // indirect + github.com/ldez/gomoddirectives v0.6.1 // indirect + github.com/ldez/grignotin v0.9.0 // indirect github.com/ldez/tagliatelle v0.7.1 // indirect - github.com/ldez/usetesting v0.4.1 // indirect + github.com/ldez/usetesting v0.4.2 // indirect github.com/leonklingele/grouper v1.1.2 // indirect github.com/macabu/inamedparam v0.1.3 // indirect github.com/magiconair/properties v1.8.9 // indirect github.com/maratori/testableexamples v1.0.0 // indirect github.com/maratori/testpackage v1.1.1 // indirect - github.com/matoous/godox v0.0.0-20241227120647-72181c086b34 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/matoous/godox v1.1.0 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/mgechev/revive v1.5.1 // indirect + github.com/mgechev/revive v1.6.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.3.2 // indirect @@ -130,15 +133,16 @@ require ( github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.18.4 // indirect + github.com/nunnatsa/ginkgolinter v0.19.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/patrickcping/pingone-go-sdk-v2/authorize v0.7.0 // indirect - github.com/patrickcping/pingone-go-sdk-v2/credentials v0.10.0 // indirect - github.com/patrickcping/pingone-go-sdk-v2/mfa v0.21.0 // indirect - github.com/patrickcping/pingone-go-sdk-v2/verify v0.8.0 // indirect + github.com/patrickcping/pingone-go-sdk-v2/authorize v0.8.0 // indirect + github.com/patrickcping/pingone-go-sdk-v2/credentials v0.11.0 // indirect + github.com/patrickcping/pingone-go-sdk-v2/mfa v0.23.0 // indirect + github.com/patrickcping/pingone-go-sdk-v2/verify v0.9.0 // indirect + github.com/pavius/impi v0.0.3 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.7.0 // indirect + github.com/polyfloyd/go-errorlint v1.7.1 // indirect github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.61.0 // indirect @@ -159,22 +163,21 @@ require ( github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.28.0 // indirect - github.com/securego/gosec/v2 v2.21.4 // indirect - github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect + github.com/securego/gosec/v2 v2.22.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/tenv v1.12.1 // indirect github.com/sonatard/noctx v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect - github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/afero v1.12.0 // indirect github.com/spf13/cast v1.7.1 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.2.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.10.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tdakkota/asciicheck v0.3.0 // indirect + github.com/tdakkota/asciicheck v0.4.0 // indirect github.com/tetafro/godot v1.4.20 // indirect github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 // indirect github.com/timonwong/loggercheck v0.10.1 // indirect @@ -183,29 +186,29 @@ require ( github.com/ultraware/funlen v0.2.0 // indirect github.com/ultraware/whitespace v0.2.0 // indirect github.com/uudashr/gocognit v1.2.0 // indirect - github.com/uudashr/iface v1.3.0 // indirect + github.com/uudashr/iface v1.3.1 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.3.0 // indirect github.com/ykadowak/zerologlint v0.1.5 // indirect gitlab.com/bosi/decorder v0.4.2 // indirect go-simpler.org/musttag v0.13.0 // indirect - go-simpler.org/sloglint v0.7.2 // indirect + go-simpler.org/sloglint v0.9.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect - golang.org/x/exp/typeparams v0.0.0-20241217172543-b2144cdd0a67 // indirect - golang.org/x/mod v0.22.0 // indirect - golang.org/x/oauth2 v0.24.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect - golang.org/x/tools v0.28.0 // indirect - google.golang.org/protobuf v1.36.1 // indirect + golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/oauth2 v0.26.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/text v0.22.0 // indirect + golang.org/x/tools v0.30.0 // indirect + google.golang.org/protobuf v1.36.4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - honnef.co/go/tools v0.5.1 // indirect + honnef.co/go/tools v0.6.0 // indirect mvdan.cc/gofumpt v0.7.0 // indirect mvdan.cc/unparam v0.0.0-20241226123437-447d509598f3 // indirect ) diff --git a/go.sum b/go.sum index 5e05861c..5c452a54 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ 4d63.com/gocheckcompilerdirectives v1.2.1 h1:AHcMYuw56NPjq/2y615IGg2kYkBdTvOaojYCBcRE7MA= 4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= -4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= -4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= +4d63.com/gochecknoglobals v0.2.2 h1:H1vdnwnMaZdQW/N+NrkT1SZMTBmcwHe9Vq8lJcYYTtU= +4d63.com/gochecknoglobals v0.2.2/go.mod h1:lLxwTQjL5eIesRbvnzIP3jZtG140FnTdz+AlMa+ogt0= github.com/4meepo/tagalign v1.4.1 h1:GYTu2FaPGOGb/xJalcqHeD4il5BiCywyEYZOA55P6J4= github.com/4meepo/tagalign v1.4.1/go.mod h1:2H9Yu6sZ67hmuraFgfZkNcg5Py9Ch/Om9l2K/2W1qS4= github.com/Abirdcfly/dupword v0.1.3 h1:9Pa1NuAsZvpFPi9Pqkd93I7LIYRURj+A//dFd5tgBeE= @@ -14,8 +14,8 @@ github.com/Antonboom/testifylint v1.5.2 h1:4s3Xhuv5AvdIgbd8wOOEeo0uZG7PbDKQyKY5l github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBgQ4+mhCojwC1P8= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= -github.com/Crocmagnon/fatcontext v0.5.3 h1:zCh/wjc9oyeF+Gmp+V60wetm8ph2tlsxocgg/J0hOps= -github.com/Crocmagnon/fatcontext v0.5.3/go.mod h1:XoCQYY1J+XTfyv74qLXvNw4xFunr3L1wkopIIKG7wGM= +github.com/Crocmagnon/fatcontext v0.7.1 h1:SC/VIbRRZQeQWj/TcQBS6JmrXcfA+BU4OGSVUt54PjM= +github.com/Crocmagnon/fatcontext v0.7.1/go.mod h1:1wMvv3NXEBJucFGfwOJBxSVWcoIO6emV215SMkW9MFU= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= @@ -36,8 +36,8 @@ github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pO github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= -github.com/alingse/nilnesserr v0.1.1 h1:7cYuJewpy9jFNMEA72Q1+3Nm3zKHzg+Q28D5f2bBFUA= -github.com/alingse/nilnesserr v0.1.1/go.mod h1:1xJPrXonEtX7wyTq8Dytns5P2hNzoWymVUIaKm4HNFg= +github.com/alingse/nilnesserr v0.1.2 h1:Yf8Iwm3z2hUUrP4muWfW83DF4nE3r1xZ26fGWUKCZlo= +github.com/alingse/nilnesserr v0.1.2/go.mod h1:1xJPrXonEtX7wyTq8Dytns5P2hNzoWymVUIaKm4HNFg= github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8gerOIVIY= github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.2.0 h1:/2Lp1bypdmK9wDIq7uWBlDF1iMUpIIS4A+pF6C9IEUU= @@ -58,8 +58,8 @@ github.com/butuzov/ireturn v0.3.1 h1:mFgbEI6m+9W8oP/oDdfA34dLisRFCj2G6o/yiI1yZrY github.com/butuzov/ireturn v0.3.1/go.mod h1:ZfRp+E7eJLC0NQmk1Nrm1LOrn/gQlOykv+cVPdiXH5M= github.com/butuzov/mirror v1.3.0 h1:HdWCXzmwlQHdVhwvsfBb2Au0r3HyINry3bDWLYXiKoc= github.com/butuzov/mirror v1.3.0/go.mod h1:AEij0Z8YMALaq4yQj9CPPVYOyJQyiexpQEQgihajRfI= -github.com/catenacyber/perfsprint v0.7.1 h1:PGW5G/Kxn+YrN04cRAZKC+ZuvlVwolYMrIyyTJ/rMmc= -github.com/catenacyber/perfsprint v0.7.1/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= +github.com/catenacyber/perfsprint v0.8.1 h1:bGOHuzHe0IkoGeY831RW4aSlt1lPRd3WRAScSWOaV7E= +github.com/catenacyber/perfsprint v0.8.1/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg= github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -80,7 +80,7 @@ github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38 github.com/ckaznocha/intrange v0.3.0 h1:VqnxtK32pxgkhJgYQEeOArVidIPg+ahLP7WBOXZd5ZY= github.com/ckaznocha/intrange v0.3.0/go.mod h1:+I/o2d2A1FBHgGELbGxzIcyd3/9l9DuwjM8FsbSS3Lo= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/curioswitch/go-reassign v0.3.0 h1:dh3kpQHuADL3cobV/sSGETA8DOv457dwl+fbBAhrQPs= github.com/curioswitch/go-reassign v0.3.0/go.mod h1:nApPCCTtqLJN/s8HfItCcKV0jIPwluBOvZP+dsJGA88= github.com/daixiang0/gci v0.13.5 h1:kThgmH1yBmZSBCh1EJVxQ7JsHpm5Oms0AMed/0LaH4c= @@ -107,10 +107,10 @@ github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/ github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/ghostiam/protogetter v0.3.8 h1:LYcXbYvybUyTIxN2Mj9h6rHrDZBDwZloPoKctWrFyJY= -github.com/ghostiam/protogetter v0.3.8/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA= -github.com/go-critic/go-critic v0.11.5 h1:TkDTOn5v7EEngMxu8KbuFqFR43USaaH8XRJLz1jhVYA= -github.com/go-critic/go-critic v0.11.5/go.mod h1:wu6U7ny9PiaHaZHcvMDmdysMqvDem162Rh3zWTrqk8M= +github.com/ghostiam/protogetter v0.3.9 h1:j+zlLLWzqLay22Cz/aYwTHKQ88GE2DQ6GkWSYFOI4lQ= +github.com/ghostiam/protogetter v0.3.9/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA= +github.com/go-critic/go-critic v0.12.0 h1:iLosHZuye812wnkEz1Xu3aBwn5ocCPfc9yqmFG9pa6w= +github.com/go-critic/go-critic v0.12.0/go.mod h1:DpE0P6OVc6JzVYzmM5gq5jMU31zLr4am5mB/VfFK64w= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= @@ -149,16 +149,16 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUPPyAKJuzv8pEJU= github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s= -github.com/golangci/gofmt v0.0.0-20241223200906-057b0627d9b9 h1:t5wybL6RtO83VwoMOb7U/Peqe3gGKQlPIC66wXmnkvM= -github.com/golangci/gofmt v0.0.0-20241223200906-057b0627d9b9/go.mod h1:Ag3L7sh7E28qAp/5xnpMMTuGYqxLZoSaEHZDkZB1RgU= -github.com/golangci/golangci-lint v1.63.2 h1:igdU9duGfb/TiON2SRuNh0SXK0qtx72jjApj1NbaJso= -github.com/golangci/golangci-lint v1.63.2/go.mod h1:O2+mo4qsJuG4cSXBzLbEV+5NAtntoNIbAv428zaEY/s= +github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d h1:viFft9sS/dxoYY0aiOTsLKO2aZQAPT4nlQCsimGcSGE= +github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d/go.mod h1:ivJ9QDg0XucIkmwhzCDsqcnxxlDStoTl89jDMIoNxKY= +github.com/golangci/golangci-lint v1.64.5 h1:5omC86XFBKXZgCrVdUWU+WNHKd+CWCxNx717KXnzKZY= +github.com/golangci/golangci-lint v1.64.5/go.mod h1:WZnwq8TF0z61h3jLQ7Sk5trcP7b3kUFxLD6l1ivtdvU= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+2f7zX0H6Jkw1Ol6c= github.com/golangci/plugin-module-register v0.1.1/go.mod h1:TTpqoB6KkwOJMV8u7+NyXMrkwwESJLOkfl9TxR1DGFc= -github.com/golangci/revgrep v0.5.3 h1:3tL7c1XBMtWHHqVpS5ChmiAAoe4PF/d5+ULzV9sLAzs= -github.com/golangci/revgrep v0.5.3/go.mod h1:U4R/s9dlXZsg8uJmaR1GrloUr14D7qDl8gi2iPXJH8k= +github.com/golangci/revgrep v0.8.0 h1:EZBctwbVd0aMeRnNUsFogoyayvKHyxlV3CdUA46FX2s= +github.com/golangci/revgrep v0.8.0/go.mod h1:U4R/s9dlXZsg8uJmaR1GrloUr14D7qDl8gi2iPXJH8k= github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed h1:IURFTjxeTfNFP0hTEi1YKjB/ub8zkpaOqFFMApi2EAs= github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed/go.mod h1:XLXN8bNw4CGRPaqgl3bv/lhz7bsGPh4/xSaMTbo2vkQ= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -168,8 +168,8 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/gordonklaus/ineffassign v0.1.0 h1:y2Gd/9I7MdY1oEIt+n+rowjBNDcLQq3RsH5hwJd0f9s= github.com/gordonklaus/ineffassign v0.1.0/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= @@ -178,8 +178,8 @@ github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXf github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= github.com/gostaticanalysis/comment v1.5.0 h1:X82FLl+TswsUMpMh17srGRuKaaXprTaytmEpgnKIDu8= github.com/gostaticanalysis/comment v1.5.0/go.mod h1:V6eb3gpCv9GNVqb6amXzEUX3jXLVK/AdA+IrAMSqvEc= -github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= -github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= +github.com/gostaticanalysis/forcetypeassert v0.2.0 h1:uSnWrrUEYDr86OCxWa4/Tp2jeYDlogZiZHzGkWFefTk= +github.com/gostaticanalysis/forcetypeassert v0.2.0/go.mod h1:M5iPavzE9pPqWyeiVXSFghQjljW1+l/Uke3PXHS6ILY= github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk= github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= @@ -208,8 +208,8 @@ github.com/jjti/go-spancheck v0.6.4 h1:Tl7gQpYf4/TMU7AT84MN83/6PutY21Nb9fuQjFTpR github.com/jjti/go-spancheck v0.6.4/go.mod h1:yAEYdKJ2lRkDA8g7X+oKUHXOWVAXSBJRv04OhF+QUjk= github.com/julz/importas v0.2.0 h1:y+MJN/UdL63QbFJHws9BVC5RpA2iq0kpjrFajTGivjQ= github.com/julz/importas v0.2.0/go.mod h1:pThlt589EnCYtMnmhmRYY/qn9lCf/frPOK+WMx3xiJY= -github.com/karamaru-alpha/copyloopvar v1.1.0 h1:x7gNyKcC2vRBO1H2Mks5u1VxQtYvFiym7fCjIP8RPos= -github.com/karamaru-alpha/copyloopvar v1.1.0/go.mod h1:u7CIfztblY0jZLOQZgH3oYsJzpC2A7S6u/lfgSXHy0k= +github.com/karamaru-alpha/copyloopvar v1.2.1 h1:wmZaZYIjnJ0b5UoKDjUHrikcV0zuPyyxI4SVplLd2CI= +github.com/karamaru-alpha/copyloopvar v1.2.1/go.mod h1:nFmMlFNlClC2BPvNaHMdkirmTJxVCY0lhxBtlfOypMM= github.com/kisielk/errcheck v1.8.0 h1:ZX/URYa7ilESY19ik/vBmCn6zdGQLxACwjAcWbHlYlg= github.com/kisielk/errcheck v1.8.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= @@ -226,20 +226,18 @@ github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= github.com/kunwardeep/paralleltest v1.0.10 h1:wrodoaKYzS2mdNVnc4/w31YaXFtsc21PCTdvWJ/lDDs= github.com/kunwardeep/paralleltest v1.0.10/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= -github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= -github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/lasiar/canonicalheader v1.1.2 h1:vZ5uqwvDbyJCnMhmFYimgMZnJMjwljN5VGY0VKbMXb4= github.com/lasiar/canonicalheader v1.1.2/go.mod h1:qJCeLFS0G/QlLQ506T+Fk/fWMa2VmBUiEI2cuMK4djI= -github.com/ldez/exptostd v0.3.0 h1:iKdMtUedzov89jDvuwmo0qpo+ARpZJg9hMp3428WwNg= -github.com/ldez/exptostd v0.3.0/go.mod h1:iZBRYaUmcW5jwCR3KROEZ1KivQQp6PHXbDPk9hqJKCQ= -github.com/ldez/gomoddirectives v0.6.0 h1:Jyf1ZdTeiIB4dd+2n4qw+g4aI9IJ6JyfOZ8BityWvnA= -github.com/ldez/gomoddirectives v0.6.0/go.mod h1:TuwOGYoPAoENDWQpe8DMqEm5nIfjrxZXmxX/CExWyZ4= -github.com/ldez/grignotin v0.7.0 h1:vh0dI32WhHaq6LLPZ38g7WxXuZ1+RzyrJ7iPG9JMa8c= -github.com/ldez/grignotin v0.7.0/go.mod h1:uaVTr0SoZ1KBii33c47O1M8Jp3OP3YDwhZCmzT9GHEk= +github.com/ldez/exptostd v0.4.1 h1:DIollgQ3LWZMp3HJbSXsdE2giJxMfjyHj3eX4oiD6JU= +github.com/ldez/exptostd v0.4.1/go.mod h1:iZBRYaUmcW5jwCR3KROEZ1KivQQp6PHXbDPk9hqJKCQ= +github.com/ldez/gomoddirectives v0.6.1 h1:Z+PxGAY+217f/bSGjNZr/b2KTXcyYLgiWI6geMBN2Qc= +github.com/ldez/gomoddirectives v0.6.1/go.mod h1:cVBiu3AHR9V31em9u2kwfMKD43ayN5/XDgr+cdaFaKs= +github.com/ldez/grignotin v0.9.0 h1:MgOEmjZIVNn6p5wPaGp/0OKWyvq42KnzAt/DAb8O4Ow= +github.com/ldez/grignotin v0.9.0/go.mod h1:uaVTr0SoZ1KBii33c47O1M8Jp3OP3YDwhZCmzT9GHEk= github.com/ldez/tagliatelle v0.7.1 h1:bTgKjjc2sQcsgPiT902+aadvMjCeMHrY7ly2XKFORIk= github.com/ldez/tagliatelle v0.7.1/go.mod h1:3zjxUpsNB2aEZScWiZTHrAXOl1x25t3cRmzfK1mlo2I= -github.com/ldez/usetesting v0.4.1 h1:T/4Bk3YDX6XUBtdNDDFymlr5GBekKA4j7HUtrv1YaaI= -github.com/ldez/usetesting v0.4.1/go.mod h1:eEs46T3PpQ+9RgN9VjpY6qWdiw2/QmfiDeWmdZdrjIQ= +github.com/ldez/usetesting v0.4.2 h1:J2WwbrFGk3wx4cZwSMiCQQ00kjGR0+tuuyW0Lqm4lwA= +github.com/ldez/usetesting v0.4.2/go.mod h1:eEs46T3PpQ+9RgN9VjpY6qWdiw2/QmfiDeWmdZdrjIQ= github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= github.com/leonklingele/grouper v1.1.2/go.mod h1:6D0M/HVkhs2yRKRFZUoGjeDy7EZTfFBE9gl4kjmIGkA= github.com/macabu/inamedparam v0.1.3 h1:2tk/phHkMlEL/1GNe/Yf6kkR/hkcUdAEY3L0hjYV1Mk= @@ -252,12 +250,13 @@ github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= -github.com/matoous/godox v0.0.0-20241227120647-72181c086b34 h1:EJiRbP3iVnGbBj9EnP+jOQqx/PI65WVByQRyk37fy4s= -github.com/matoous/godox v0.0.0-20241227120647-72181c086b34/go.mod h1:jgE/3fUXiTurkdHOLT5WEkThTSuE7yxHv5iWPa80afs= +github.com/matoous/godox v1.1.0 h1:W5mqwbyWrwZv6OQ5Z1a/DHGMOvXYCBP3+Ht7KMoJhq4= +github.com/matoous/godox v1.1.0/go.mod h1:jgE/3fUXiTurkdHOLT5WEkThTSuE7yxHv5iWPa80afs= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -265,8 +264,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mgechev/revive v1.5.1 h1:hE+QPeq0/wIzJwOphdVyUJ82njdd8Khp4fUIHGZHW3M= -github.com/mgechev/revive v1.5.1/go.mod h1:lC9AhkJIBs5zwx8wkudyHrU+IJkrEKmpCmGMnIJPk4o= +github.com/mgechev/revive v1.6.1 h1:ncK0ZCMWtb8GXwVAmk+IeWF2ULIDsvRxSRfg5sTwQ2w= +github.com/mgechev/revive v1.6.1/go.mod h1:/2tfHWVO8UQi/hqJsIYNEKELi+DJy/e+PQpLgTB1v88= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -281,14 +280,14 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.18.4 h1:zmX4KUR+6fk/vhUFt8DOP6KwznekhkmVSzzVJve2vyM= -github.com/nunnatsa/ginkgolinter v0.18.4/go.mod h1:AMEane4QQ6JwFz5GgjI5xLUM9S/CylO+UyM97fN2iBI= +github.com/nunnatsa/ginkgolinter v0.19.0 h1:CnHRFAeBS3LdLI9h+Jidbcc5KH71GKOmaBZQk8Srnto= +github.com/nunnatsa/ginkgolinter v0.19.0/go.mod h1:jkQ3naZDmxaZMXPWaS9rblH+i+GWXQCaS/JFIWcOH2s= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= -github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= -github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= -github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= +github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU= +github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk= +github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= +github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= @@ -296,20 +295,20 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/patrickcping/pingone-go-sdk-v2 v0.12.5 h1:8z5qI7/Mvj7nxOuR7yPcTOKqUK3X+1nwg9DFfSlvCm4= -github.com/patrickcping/pingone-go-sdk-v2 v0.12.5/go.mod h1:4Qwo23Xz1+TYFl7gVqNDXwiLaszz6BdwAH4Wsy2T7yA= -github.com/patrickcping/pingone-go-sdk-v2/authorize v0.7.0 h1:e36HmxvHy3zmt9oKHlTTgImSt1Q71RT05i6Kp4EwxWU= -github.com/patrickcping/pingone-go-sdk-v2/authorize v0.7.0/go.mod h1:2PDrgC1ufXk2IDIk4JQHx6r34r2xpkbnzKIpXFv8gYs= -github.com/patrickcping/pingone-go-sdk-v2/credentials v0.10.0 h1:NziAU4J3b18hw/4L+4TpCOBS+kd9srQR2R3xP0aEbNw= -github.com/patrickcping/pingone-go-sdk-v2/credentials v0.10.0/go.mod h1:yRGf7+tsB3/AQYsNjIIs4ScJhR885mvDYMgwHiQeMl0= -github.com/patrickcping/pingone-go-sdk-v2/management v0.45.0 h1:mGC9J52bR1+4plCWjfdWq6l6BdlUlemHWv0arzSyvsM= -github.com/patrickcping/pingone-go-sdk-v2/management v0.45.0/go.mod h1:oLB/jjAkn4oEA60nC5/0KAobvcNJbflOWnVaS6lKxv8= -github.com/patrickcping/pingone-go-sdk-v2/mfa v0.21.0 h1:/cfl+PcocLDj2m4ZgE653m3UDdIk7VEB7iVwCQ1YSH4= -github.com/patrickcping/pingone-go-sdk-v2/mfa v0.21.0/go.mod h1:Q+Ym6kktv5Y6VnVhDt//lWoOhmIKfyjo6ejRx5mLttY= -github.com/patrickcping/pingone-go-sdk-v2/risk v0.18.0 h1:+Ogq2g0s0i+SU/NoJg9+pL5+3iPyK9tFUWrDC3scHR8= -github.com/patrickcping/pingone-go-sdk-v2/risk v0.18.0/go.mod h1:ppwkDT/w2/2y2aFH+hFQgziLMsWvz2MEZvwYexREqRk= -github.com/patrickcping/pingone-go-sdk-v2/verify v0.8.0 h1:FsssxnJ/VSIxXtdvZlDn555nY+Yn1ndsg9IITyXYBbM= -github.com/patrickcping/pingone-go-sdk-v2/verify v0.8.0/go.mod h1:bCq5fHv9mSdNsm/XiT5jb3YgYnQb8F824EYfq9eAJl4= +github.com/patrickcping/pingone-go-sdk-v2 v0.12.9 h1:EznRTRLzpgHeqkBtXHBrwjIMlfLamqOurODgIKNyoBY= +github.com/patrickcping/pingone-go-sdk-v2 v0.12.9/go.mod h1:ZA09d5Rw6Mp7MBT7iJageVfzU1k6yjEjsQCLpIlFyRQ= +github.com/patrickcping/pingone-go-sdk-v2/authorize v0.8.0 h1:gEPzZToJlBcJh2Ft12dP1GCSGzsNFQFEHS7Bql86RQk= +github.com/patrickcping/pingone-go-sdk-v2/authorize v0.8.0/go.mod h1:2PDrgC1ufXk2IDIk4JQHx6r34r2xpkbnzKIpXFv8gYs= +github.com/patrickcping/pingone-go-sdk-v2/credentials v0.11.0 h1:pLiiBkROks/40vhFWJEcr/tiIEqqYdP4FWsHtfCLdIs= +github.com/patrickcping/pingone-go-sdk-v2/credentials v0.11.0/go.mod h1:yRGf7+tsB3/AQYsNjIIs4ScJhR885mvDYMgwHiQeMl0= +github.com/patrickcping/pingone-go-sdk-v2/management v0.49.0 h1:F1zE2PhxgZCu08TObPylcnXzKqdbaAXkDODWegTE7WM= +github.com/patrickcping/pingone-go-sdk-v2/management v0.49.0/go.mod h1:oLB/jjAkn4oEA60nC5/0KAobvcNJbflOWnVaS6lKxv8= +github.com/patrickcping/pingone-go-sdk-v2/mfa v0.23.0 h1:k133OY6PNO3tgNK3LBoEI+Uf9bRNKsvAkMMVUf99/Q0= +github.com/patrickcping/pingone-go-sdk-v2/mfa v0.23.0/go.mod h1:Q+Ym6kktv5Y6VnVhDt//lWoOhmIKfyjo6ejRx5mLttY= +github.com/patrickcping/pingone-go-sdk-v2/risk v0.19.0 h1:qGdwnfjsexHhTUAyBaUzheyeKWhR3Q8groqVpprzzOw= +github.com/patrickcping/pingone-go-sdk-v2/risk v0.19.0/go.mod h1:ppwkDT/w2/2y2aFH+hFQgziLMsWvz2MEZvwYexREqRk= +github.com/patrickcping/pingone-go-sdk-v2/verify v0.9.0 h1:Gnxvi7yx4NSBNOqBBydUPoR9Flp/dnnXj3129+ub9WY= +github.com/patrickcping/pingone-go-sdk-v2/verify v0.9.0/go.mod h1:bCq5fHv9mSdNsm/XiT5jb3YgYnQb8F824EYfq9eAJl4= github.com/pavius/impi v0.0.3 h1:DND6MzU+BLABhOZXbELR3FU8b+zDgcq4dOCNLhiTYuI= github.com/pavius/impi v0.0.3/go.mod h1:x/hU0bfdWIhuOT1SKwiJg++yvkk6EuOtJk8WtDZqgr8= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= @@ -320,8 +319,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.7.0 h1:Zp6lzCK4hpBDj8y8a237YK4EPrMXQWvOe3nGoH4pFrU= -github.com/polyfloyd/go-errorlint v1.7.0/go.mod h1:dGWKu85mGHnegQ2SWpEybFityCg3j7ZbwsVUxAOk9gY= +github.com/polyfloyd/go-errorlint v1.7.1 h1:RyLVXIbosq1gBdk/pChWA8zWYLsq9UEw7a1L5TVMCnA= +github.com/polyfloyd/go-errorlint v1.7.1/go.mod h1:aXjNb1x2TNhoLsk26iv1yl7a+zTnXPhwEMtEXukiLR8= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= @@ -369,10 +368,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tM github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.28.0 h1:jZnudE2zKCtYlGzLVreNp5pmCdOxXUzwsMDBkR21cyQ= github.com/sashamelentyev/usestdlibvars v1.28.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= -github.com/securego/gosec/v2 v2.21.4 h1:Le8MSj0PDmOnHJgUATjD96PaXRvCpKC+DGJvwyy0Mlk= -github.com/securego/gosec/v2 v2.21.4/go.mod h1:Jtb/MwRQfRxCXyCm1rfM1BEiiiTfUOdyzzAhlr6lUTA= -github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= -github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= +github.com/securego/gosec/v2 v2.22.1 h1:IcBt3TpI5Y9VN1YlwjSpM2cHu0i3Iw52QM+PQeg7jN8= +github.com/securego/gosec/v2 v2.22.1/go.mod h1:4bb95X4Jz7VSEPdVjC0hD7C/yR6kdeUBvCPOy9gDQ0g= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -387,14 +384,15 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= +github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= +github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= @@ -417,8 +415,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tdakkota/asciicheck v0.3.0 h1:LqDGgZdholxZMaJgpM6b0U9CFIjDCbFdUF00bDnBKOQ= -github.com/tdakkota/asciicheck v0.3.0/go.mod h1:KoJKXuX/Z/lt6XzLo8WMBfQGzak0SrAKZlvRr4tg8Ac= +github.com/tdakkota/asciicheck v0.4.0 h1:VZ13Itw4k1i7d+dpDSNS8Op645XgGHpkCEh/WHicgWw= +github.com/tdakkota/asciicheck v0.4.0/go.mod h1:0k7M3rCfRXb0Z6bwgvkEIMleKH3kXNz9UqJ9Xuqopr8= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= @@ -439,8 +437,8 @@ github.com/ultraware/whitespace v0.2.0 h1:TYowo2m9Nfj1baEQBjuHzvMRbp19i+RCcRYrSW github.com/ultraware/whitespace v0.2.0/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= github.com/uudashr/gocognit v1.2.0 h1:3BU9aMr1xbhPlvJLSydKwdLN3tEUUrzPSSM8S4hDYRA= github.com/uudashr/gocognit v1.2.0/go.mod h1:k/DdKPI6XBZO1q7HgoV2juESI2/Ofj9AcHPZhBBdrTU= -github.com/uudashr/iface v1.3.0 h1:zwPch0fs9tdh9BmL5kcgSpvnObV+yHjO4JjVBl8IA10= -github.com/uudashr/iface v1.3.0/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= +github.com/uudashr/iface v1.3.1 h1:bA51vmVx1UIhiIsQFSNq6GZ6VPTk3WNMZgRiCe9R29U= +github.com/uudashr/iface v1.3.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= @@ -461,8 +459,8 @@ go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= go-simpler.org/musttag v0.13.0 h1:Q/YAW0AHvaoaIbsPj3bvEI5/QFP7w696IMUpnKXQfCE= go-simpler.org/musttag v0.13.0/go.mod h1:FTzIGeK6OkKlUDVpj0iQUXZLUO1Js9+mvykDQy9C5yM= -go-simpler.org/sloglint v0.7.2 h1:Wc9Em/Zeuu7JYpl+oKoYOsQSy2X560aVueCW/m6IijY= -go-simpler.org/sloglint v0.7.2/go.mod h1:US+9C80ppl7VsThQclkM7BkCHQAzuz8kHLsW3ppuluo= +go-simpler.org/sloglint v0.9.0 h1:/40NQtjRx9txvsB/RN022KsUJU+zaaSb/9q9BSefSrE= +go-simpler.org/sloglint v0.9.0/go.mod h1:G/OrAF6uxj48sHahCzrbarVMptL2kjWTaUeC8+fOGww= go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -481,8 +479,8 @@ golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/ golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20241217172543-b2144cdd0a67 h1:aOkGQa5iWYZjkoBaUQ8KyQfznXDSSumUfxSlEWSnmIM= -golang.org/x/exp/typeparams v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac h1:TSSpLIG4v+p0rPv1pNOQtl1I8knsO4S9trOxNMOLVP4= +golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -494,9 +492,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -507,16 +504,15 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= -golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= -golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= +golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE= +golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -526,8 +522,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -547,18 +543,16 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= @@ -570,15 +564,13 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= @@ -592,19 +584,18 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= -golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= -golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= -golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= -google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= +google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -616,8 +607,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I= -honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= +honnef.co/go/tools v0.6.0 h1:TAODvD3knlq75WCp2nyGJtT4LeRV/o7NN9nYPeVJXf8= +honnef.co/go/tools v0.6.0/go.mod h1:3puzxxljPCe8RGJX7BIy1plGbxEOZni5mR2aXe3/uk4= mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo= mvdan.cc/unparam v0.0.0-20241226123437-447d509598f3 h1:OPdLMIX29kquQXSiXmnwzHP1bc+JlH0S2l8SfVK9yWE= diff --git a/internal/tools/tools.go b/internal/tools/tools.go deleted file mode 100644 index c2eeb598..00000000 --- a/internal/tools/tools.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build tools -// +build tools - -package tools - -// Manage tool dependencies via go.mod. -// -//nolint:all -import ( - _ "github.com/golangci/golangci-lint/cmd/golangci-lint" - _ "github.com/pavius/impi" -) From 298ccf7354f0a9d4d135c0cb642f66c41624087f Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 20 Feb 2025 12:03:22 -0500 Subject: [PATCH 05/15] golangci-lint do not print resource usage --- .golangci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 0c5d8f8c..4128423b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,9 +1,9 @@ # Options for analysis running. run: - print-resources-usage: true + print-resources-usage: false timeout: 30m # Use all default linters + those defined here linters: enable: - - gosec \ No newline at end of file + - gosec From 1c782f5b9b50f82eddb36f21ffbeac34ece91889 Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 20 Feb 2025 12:05:00 -0500 Subject: [PATCH 06/15] remove usage line in golang-ci lint yml --- .golangci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 4128423b..f41f34c1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,5 @@ # Options for analysis running. run: - print-resources-usage: false timeout: 30m # Use all default linters + those defined here From 92a13fb094e23d19cd28490b8dd568d26f6b8476 Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 20 Feb 2025 17:59:25 -0500 Subject: [PATCH 07/15] rework autocompletion package, add inline system output errors, clean up flag methods --- cmd/config/delete_profile.go | 4 +- cmd/config/set_active_profile.go | 4 +- cmd/config/view_profile.go | 4 +- cmd/platform/export.go | 52 ++++++------------- cmd/request/request.go | 15 ++---- .../{config => }/config_args.go | 12 ++--- internal/autocompletion/export_flags.go | 26 ++++++++++ .../autocompletion/platform/export_flags.go | 31 ----------- .../autocompletion/request/request_flags.go | 22 -------- internal/autocompletion/request_flags.go | 14 +++++ internal/autocompletion/root_flags.go | 12 +---- internal/commands/request/request_internal.go | 17 +++--- 12 files changed, 80 insertions(+), 133 deletions(-) rename internal/autocompletion/{config => }/config_args.go (62%) create mode 100644 internal/autocompletion/export_flags.go delete mode 100644 internal/autocompletion/platform/export_flags.go delete mode 100644 internal/autocompletion/request/request_flags.go create mode 100644 internal/autocompletion/request_flags.go diff --git a/cmd/config/delete_profile.go b/cmd/config/delete_profile.go index 2e0ca5a7..0cb5f7e4 100644 --- a/cmd/config/delete_profile.go +++ b/cmd/config/delete_profile.go @@ -4,7 +4,7 @@ import ( "os" "github.com/pingidentity/pingcli/cmd/common" - autocompletion_config_args "github.com/pingidentity/pingcli/internal/autocompletion/config" + "github.com/pingidentity/pingcli/internal/autocompletion" config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/configuration/options" "github.com/pingidentity/pingcli/internal/logger" @@ -33,7 +33,7 @@ The profile to delete will be removed from the CLI configuration file.`, RunE: configDeleteProfileRunE, Short: "Delete a custom configuration profile.", Use: "delete-profile [flags] [profile-name]", - ValidArgsFunction: autocompletion_config_args.ReturnNonActiveProfiles, + ValidArgsFunction: autocompletion.ConfigReturnNonActiveProfilesFunc, } cmd.Flags().AddFlag(options.ConfigDeleteAutoAcceptOption.Flag) diff --git a/cmd/config/set_active_profile.go b/cmd/config/set_active_profile.go index fe9193ae..7b896289 100644 --- a/cmd/config/set_active_profile.go +++ b/cmd/config/set_active_profile.go @@ -4,7 +4,7 @@ import ( "os" "github.com/pingidentity/pingcli/cmd/common" - autocompletion_config_args "github.com/pingidentity/pingcli/internal/autocompletion/config" + "github.com/pingidentity/pingcli/internal/autocompletion" config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/logger" "github.com/spf13/cobra" @@ -28,7 +28,7 @@ func NewConfigSetActiveProfileCommand() *cobra.Command { Short: "Set a custom configuration profile as the in-use profile.", Use: "set-active-profile [flags] [profile-name]", // Auto-completion function to return all valid profile names - ValidArgsFunction: autocompletion_config_args.ReturnNonActiveProfiles, + ValidArgsFunction: autocompletion.ConfigReturnNonActiveProfilesFunc, } return cmd diff --git a/cmd/config/view_profile.go b/cmd/config/view_profile.go index 489b347b..6b52b7ac 100644 --- a/cmd/config/view_profile.go +++ b/cmd/config/view_profile.go @@ -2,7 +2,7 @@ package config import ( "github.com/pingidentity/pingcli/cmd/common" - autocompletion_config_args "github.com/pingidentity/pingcli/internal/autocompletion/config" + "github.com/pingidentity/pingcli/internal/autocompletion" config_internal "github.com/pingidentity/pingcli/internal/commands/config" "github.com/pingidentity/pingcli/internal/logger" "github.com/spf13/cobra" @@ -26,7 +26,7 @@ func NewConfigViewProfileCommand() *cobra.Command { Short: "View the stored configuration of a custom configuration profile.", Use: "view-profile [flags] [profile-name]", // Auto-completion function to return all valid profile names - ValidArgsFunction: autocompletion_config_args.ViewProfile, + ValidArgsFunction: autocompletion.ConfigViewProfileFunc, } return cmd diff --git a/cmd/platform/export.go b/cmd/platform/export.go index 3e117f48..8b58271d 100644 --- a/cmd/platform/export.go +++ b/cmd/platform/export.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/pingidentity/pingcli/cmd/common" - autocompletion_export_flags "github.com/pingidentity/pingcli/internal/autocompletion/platform" + "github.com/pingidentity/pingcli/internal/autocompletion" platform_internal "github.com/pingidentity/pingcli/internal/commands/platform" "github.com/pingidentity/pingcli/internal/configuration/options" "github.com/pingidentity/pingcli/internal/logger" @@ -38,10 +38,6 @@ const ( pingcli platform export --services pingfederate --x-bypass-external-validation=false --ca-certificate-pem-files "/path/to/cert.pem,/path/to/cert2.pem" --insecure-trust-all-tls=false` ) -func returnExportSystemError(err error) { - output.SystemError(fmt.Sprintf("Unable to register auto completion for export flag: %v", err), nil) -} - func NewExportCommand() *cobra.Command { cmd := &cobra.Command{ Args: common.ExactArgs(0), @@ -64,6 +60,22 @@ func NewExportCommand() *cobra.Command { initPingFederateAccessTokenFlags(cmd) initPingFederateClientCredentialsFlags(cmd) + // auto-completion + err := cmd.RegisterFlagCompletionFunc(options.PlatformExportExportFormatOption.CobraParamName, autocompletion.PlatformExportFormatFunc) + if err != nil { + output.SystemError(fmt.Sprintf("Unable to register auto completion for platform export flag %s: %v", options.PlatformExportExportFormatOption.CobraParamName, err), nil) + } + + err = cmd.RegisterFlagCompletionFunc(options.PlatformExportServiceOption.CobraParamName, autocompletion.PlatformExportServicesFunc) + if err != nil { + output.SystemError(fmt.Sprintf("Unable to register auto completion for platform export flag %s: %v", options.PlatformExportServiceOption.CobraParamName, err), nil) + } + + err = cmd.RegisterFlagCompletionFunc(options.PingOneAuthenticationTypeOption.CobraParamName, autocompletion.PlatformExportPingOneAuthenticationTypeFunc) + if err != nil { + output.SystemError(fmt.Sprintf("Unable to register auto completion for platform export flag %s: %v", options.PingOneAuthenticationTypeOption.CobraParamName, err), nil) + } + return cmd } @@ -77,19 +89,7 @@ func exportRunE(cmd *cobra.Command, args []string) error { func initGeneralExportFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PlatformExportExportFormatOption.Flag) - // auto-completion - err := cmd.RegisterFlagCompletionFunc("format", autocompletion_export_flags.Format) - if err != nil { - returnExportSystemError(err) - } - cmd.Flags().AddFlag(options.PlatformExportServiceOption.Flag) - // auto-completion - err = cmd.RegisterFlagCompletionFunc("services", autocompletion_export_flags.Services) - if err != nil { - returnExportSystemError(err) - } - cmd.Flags().AddFlag(options.PlatformExportOutputDirectoryOption.Flag) cmd.Flags().AddFlag(options.PlatformExportOverwriteOption.Flag) cmd.Flags().AddFlag(options.PlatformExportPingOneEnvironmentIDOption.Flag) @@ -99,20 +99,8 @@ func initPingOneExportFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PingOneAuthenticationWorkerEnvironmentIDOption.Flag) cmd.Flags().AddFlag(options.PingOneAuthenticationWorkerClientIDOption.Flag) cmd.Flags().AddFlag(options.PingOneAuthenticationWorkerClientSecretOption.Flag) - cmd.Flags().AddFlag(options.PingOneAuthenticationTypeOption.Flag) - // auto-completion - err := cmd.RegisterFlagCompletionFunc("pingone-authentication-type", autocompletion_export_flags.PingOneAuthenticationType) - if err != nil { - returnExportSystemError(err) - } - cmd.Flags().AddFlag(options.PingOneRegionCodeOption.Flag) - // auto-completion - err = cmd.RegisterFlagCompletionFunc("pingone-region-code", autocompletion_export_flags.PingOneRegionCode) - if err != nil { - returnExportSystemError(err) - } cmd.MarkFlagsRequiredTogether( options.PingOneAuthenticationWorkerEnvironmentIDOption.CobraParamName, @@ -134,13 +122,7 @@ func initPingFederateGeneralFlags(cmd *cobra.Command) { cmd.Flags().AddFlag(options.PingFederateXBypassExternalValidationHeaderOption.Flag) cmd.Flags().AddFlag(options.PingFederateCACertificatePemFilesOption.Flag) cmd.Flags().AddFlag(options.PingFederateInsecureTrustAllTLSOption.Flag) - cmd.Flags().AddFlag(options.PingFederateAuthenticationTypeOption.Flag) - // auto-completion - err := cmd.RegisterFlagCompletionFunc("pingfederate-authentication-type", autocompletion_export_flags.PingFederateAuthenticationType) - if err != nil { - returnExportSystemError(err) - } } func initPingFederateBasicAuthFlags(cmd *cobra.Command) { diff --git a/cmd/request/request.go b/cmd/request/request.go index 9fcd2ac0..3273ba81 100644 --- a/cmd/request/request.go +++ b/cmd/request/request.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/pingidentity/pingcli/cmd/common" - autocompletion_request_flags "github.com/pingidentity/pingcli/internal/autocompletion/request" + "github.com/pingidentity/pingcli/internal/autocompletion" request_internal "github.com/pingidentity/pingcli/internal/commands/request" "github.com/pingidentity/pingcli/internal/configuration/options" "github.com/pingidentity/pingcli/internal/logger" @@ -29,10 +29,6 @@ const ( pingcli request --service pingone --http-method DELETE environments/$MY_ENVIRONMENT_ID/applications/$MY_APPLICATION_ID/attributes/$MY_ATTRIBUTE_MAPPING_ID` ) -func returnServiceSystemError(err error) { - output.SystemError(fmt.Sprintf("Unable to register auto completion for service flag: %v", err), nil) -} - func NewRequestCommand() *cobra.Command { cmd := &cobra.Command{ Args: common.ExactArgs(1), @@ -59,18 +55,17 @@ The command offers a cURL-like experience to interact with the Ping platform ser // --http-method, -m cmd.Flags().AddFlag(options.RequestHTTPMethodOption.Flag) // auto-completion - err := cmd.RegisterFlagCompletionFunc("http-method", autocompletion_request_flags.HTTPMethod) + err := cmd.RegisterFlagCompletionFunc(options.RequestHTTPMethodOption.CobraParamName, autocompletion.RequestHTTPMethodFunc) if err != nil { - returnServiceSystemError(err) + output.SystemError(fmt.Sprintf("Unable to register auto completion for request flag %s: %v", options.RequestHTTPMethodOption.CobraParamName, err), nil) } // --service, -s cmd.Flags().AddFlag(options.RequestServiceOption.Flag) // auto-completion - err = cmd.RegisterFlagCompletionFunc("service", autocompletion_request_flags.Service) - + err = cmd.RegisterFlagCompletionFunc(options.RequestServiceOption.CobraParamName, autocompletion.RequestServiceFunc) if err != nil { - returnServiceSystemError(err) + output.SystemError(fmt.Sprintf("Unable to register auto completion for request flag %s: %v", options.RequestHTTPMethodOption.CobraParamName, err), nil) } return cmd diff --git a/internal/autocompletion/config/config_args.go b/internal/autocompletion/config_args.go similarity index 62% rename from internal/autocompletion/config/config_args.go rename to internal/autocompletion/config_args.go index cf49eba6..8a7cc2ab 100644 --- a/internal/autocompletion/config/config_args.go +++ b/internal/autocompletion/config_args.go @@ -1,4 +1,4 @@ -package autocompletion_config_args +package autocompletion import ( "fmt" @@ -9,15 +9,11 @@ import ( "github.com/spf13/cobra" ) -func ViewProfile(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - profileNames := profiles.GetMainConfig().ProfileNames() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoFileComp - } - return profileNames, cobra.ShellCompDirectiveNoFileComp +func ConfigViewProfileFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return profiles.GetMainConfig().ProfileNames(), cobra.ShellCompDirectiveNoFileComp } -func ReturnNonActiveProfiles(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { +func ConfigReturnNonActiveProfilesFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { profileNames := profiles.GetMainConfig().ProfileNames() if len(args) != 0 { return nil, cobra.ShellCompDirectiveNoFileComp diff --git a/internal/autocompletion/export_flags.go b/internal/autocompletion/export_flags.go new file mode 100644 index 00000000..078c3513 --- /dev/null +++ b/internal/autocompletion/export_flags.go @@ -0,0 +1,26 @@ +package autocompletion + +import ( + "github.com/pingidentity/pingcli/internal/customtypes" + "github.com/spf13/cobra" +) + +func PlatformExportFormatFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return customtypes.ExportFormatValidValues(), cobra.ShellCompDirectiveNoFileComp +} + +func PlatformExportPingFederateAuthenticationTypeFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return customtypes.PingFederateAuthenticationTypeValidValues(), cobra.ShellCompDirectiveNoFileComp +} + +func PlatformExportPingOneAuthenticationTypeFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return customtypes.PingOneAuthenticationTypeValidValues(), cobra.ShellCompDirectiveNoFileComp +} + +func PlatformExportPingOneRegionCodeFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return customtypes.PingOneRegionCodeValidValues(), cobra.ShellCompDirectiveNoFileComp +} + +func PlatformExportServicesFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return customtypes.ExportServicesValidValues(), cobra.ShellCompDirectiveNoFileComp +} diff --git a/internal/autocompletion/platform/export_flags.go b/internal/autocompletion/platform/export_flags.go deleted file mode 100644 index 50308d3a..00000000 --- a/internal/autocompletion/platform/export_flags.go +++ /dev/null @@ -1,31 +0,0 @@ -package autocompletion_export_flags - -import ( - "github.com/pingidentity/pingcli/internal/customtypes" - "github.com/spf13/cobra" -) - -func Format(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validExportFormats := customtypes.ExportFormatValidValues() - return validExportFormats, cobra.ShellCompDirectiveNoFileComp -} - -func PingFederateAuthenticationType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validPingFedAuthTypes := customtypes.PingFederateAuthenticationTypeValidValues() - return validPingFedAuthTypes, cobra.ShellCompDirectiveNoFileComp -} - -func PingOneAuthenticationType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validPingOneAuthTypes := customtypes.PingOneAuthenticationTypeValidValues() - return validPingOneAuthTypes, cobra.ShellCompDirectiveNoFileComp -} - -func PingOneRegionCode(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validRegionCodes := customtypes.PingOneRegionCodeValidValues() - return validRegionCodes, cobra.ShellCompDirectiveNoFileComp -} - -func Services(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validServices := customtypes.ExportServicesValidValues() - return validServices, cobra.ShellCompDirectiveNoFileComp -} diff --git a/internal/autocompletion/request/request_flags.go b/internal/autocompletion/request/request_flags.go deleted file mode 100644 index 2d562386..00000000 --- a/internal/autocompletion/request/request_flags.go +++ /dev/null @@ -1,22 +0,0 @@ -package autocompletion_request_flags - -import ( - "github.com/pingidentity/pingcli/internal/customtypes" - "github.com/spf13/cobra" -) - -func HTTPMethod(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validHTTPMethods := customtypes.HTTPMethodValidValues() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoFileComp - } - return validHTTPMethods, cobra.ShellCompDirectiveNoFileComp -} - -func Service(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validServices := customtypes.RequestServiceValidValues() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoFileComp - } - return validServices, cobra.ShellCompDirectiveNoFileComp -} diff --git a/internal/autocompletion/request_flags.go b/internal/autocompletion/request_flags.go new file mode 100644 index 00000000..f4cc1157 --- /dev/null +++ b/internal/autocompletion/request_flags.go @@ -0,0 +1,14 @@ +package autocompletion + +import ( + "github.com/pingidentity/pingcli/internal/customtypes" + "github.com/spf13/cobra" +) + +func RequestHTTPMethodFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return customtypes.HTTPMethodValidValues(), cobra.ShellCompDirectiveNoFileComp +} + +func RequestServiceFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return customtypes.RequestServiceValidValues(), cobra.ShellCompDirectiveNoFileComp +} diff --git a/internal/autocompletion/root_flags.go b/internal/autocompletion/root_flags.go index 5ee6debc..8ed07be6 100644 --- a/internal/autocompletion/root_flags.go +++ b/internal/autocompletion/root_flags.go @@ -7,17 +7,9 @@ import ( ) func Profile(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validProfileNames := profiles.GetMainConfig().ProfileNames() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoFileComp - } - return validProfileNames, cobra.ShellCompDirectiveNoFileComp + return profiles.GetMainConfig().ProfileNames(), cobra.ShellCompDirectiveNoFileComp } func OutputFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - validOutputFormats := customtypes.OutputFormatValidValues() - if len(args) != 0 { - return nil, cobra.ShellCompDirectiveNoFileComp - } - return validOutputFormats, cobra.ShellCompDirectiveNoFileComp + return customtypes.OutputFormatValidValues(), cobra.ShellCompDirectiveNoFileComp } diff --git a/internal/commands/request/request_internal.go b/internal/commands/request/request_internal.go index 72c00fe8..f528d647 100644 --- a/internal/commands/request/request_internal.go +++ b/internal/commands/request/request_internal.go @@ -288,23 +288,18 @@ func getData() (data string, err error) { return data, nil } + // get data from file data, err = profiles.GetOptionValue(options.RequestDataOption) if err != nil { return "", err } - - // if data string first character is '@', read from file if data != "" { - if strings.HasPrefix(data, "@") { - filePath := strings.TrimPrefix(data, "@") - - contents, err := os.ReadFile(filePath) - if err != nil { - return "", err - } - - data = string(contents) + contents, err := os.ReadFile(data) + if err != nil { + return "", err } + + return string(contents), nil } return data, nil From fe84df1e90fdaaf0bcc6d7f9ded24044a1f1e6cc Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 20 Feb 2025 18:03:08 -0500 Subject: [PATCH 08/15] update usage example --- cmd/request/request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/request/request.go b/cmd/request/request.go index 3273ba81..8614b19c 100644 --- a/cmd/request/request.go +++ b/cmd/request/request.go @@ -20,7 +20,7 @@ const ( pingcli request --service pingone --http-method GET --output-format json environments/$MY_ENVIRONMENT_ID Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment with JSON data sourced from a file. - pingcli request --service pingone --http-method POST --data @./my-environment.json environments + pingcli request --service pingone --http-method POST --data ./my-environment.json environments Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment using raw JSON data. pingcli request --service pingone --http-method POST --data-raw '{"name": "My environment"}' environments From 140512c3dc95c3a75b03b4cb3c56dab4567ffcf7 Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 20 Feb 2025 18:09:09 -0500 Subject: [PATCH 09/15] update data test --- internal/commands/request/request_internal_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/commands/request/request_internal_test.go b/internal/commands/request/request_internal_test.go index 476600dc..6d9e3603 100644 --- a/internal/commands/request/request_internal_test.go +++ b/internal/commands/request/request_internal_test.go @@ -171,7 +171,7 @@ func Test_getData(t *testing.T) { testutils_viper.InitVipers(t) expectedData := "{data: 'json'}" - t.Setenv(options.RequestDataOption.EnvVar, expectedData) + t.Setenv(options.RequestDataRawOption.EnvVar, expectedData) data, err := getData() testutils.CheckExpectedError(t, err, nil) @@ -185,7 +185,7 @@ func Test_getData(t *testing.T) { func Test_getData_EmptyData(t *testing.T) { testutils_viper.InitVipers(t) - t.Setenv(options.RequestDataOption.EnvVar, "") + t.Setenv(options.RequestDataRawOption.EnvVar, "") data, err := getData() testutils.CheckExpectedError(t, err, nil) From 203a35d7c268845eda943d0c76e6a19a3cc096fb Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Thu, 20 Feb 2025 18:12:14 -0500 Subject: [PATCH 10/15] remove @ from data tests --- internal/commands/request/request_internal_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/commands/request/request_internal_test.go b/internal/commands/request/request_internal_test.go index 6d9e3603..232c435d 100644 --- a/internal/commands/request/request_internal_test.go +++ b/internal/commands/request/request_internal_test.go @@ -207,7 +207,7 @@ func Test_getData_FileInput(t *testing.T) { t.Fatalf("failed to write test file: %v", err) } - t.Setenv(options.RequestDataOption.EnvVar, "@"+testFile) + t.Setenv(options.RequestDataOption.EnvVar, testFile) data, err := getData() testutils.CheckExpectedError(t, err, nil) @@ -221,7 +221,7 @@ func Test_getData_FileInput(t *testing.T) { func Test_getData_NonExistentFileInput(t *testing.T) { testutils_viper.InitVipers(t) - t.Setenv(options.RequestDataOption.EnvVar, "@non_existent_file.json") + t.Setenv(options.RequestDataOption.EnvVar, "non_existent_file.json") _, err := getData() expectedErrorPattern := `^open .*: no such file or directory$` From b7fe55591e431a028200e19a87d4ac2d62ec686d Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Fri, 21 Feb 2025 10:18:56 -0500 Subject: [PATCH 11/15] update global flag autocomplete error inline outputs --- cmd/root.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 57e1c665..c397c70a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -30,10 +30,6 @@ func init() { cobra.OnInitialize(initViperProfile) } -func returnRootSystemError(err error) { - output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli flag: %v", err), nil) -} - // rootCmd represents the base command when called without any subcommands func NewRootCommand(version string, commit string) *cobra.Command { cmd := &cobra.Command{ @@ -60,9 +56,9 @@ func NewRootCommand(version string, commit string) *cobra.Command { // --profile, -P cmd.PersistentFlags().AddFlag(options.RootProfileOption.Flag) // auto-completion - err := cmd.RegisterFlagCompletionFunc("profile", autocompletion_root_flags.Profile) + err := cmd.RegisterFlagCompletionFunc(options.RootActiveProfileOption.CobraParamName, autocompletion_root_flags.Profile) if err != nil { - returnRootSystemError(err) + output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli global flag %s: %v", options.RootActiveProfileOption.CobraParamName, err), nil) } // --no-color @@ -71,9 +67,9 @@ func NewRootCommand(version string, commit string) *cobra.Command { // --output-format, -O cmd.PersistentFlags().AddFlag(options.RootOutputFormatOption.Flag) // auto-completion - err = cmd.RegisterFlagCompletionFunc("output-format", autocompletion_root_flags.OutputFormat) + err = cmd.RegisterFlagCompletionFunc(options.RootOutputFormatOption.CobraParamName, autocompletion_root_flags.OutputFormat) if err != nil { - returnRootSystemError(err) + output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli global flag %s: %v", options.RootOutputFormatOption.CobraParamName, err), nil) } // Make sure cobra is outputting to stdout and stderr From b57bff3707d383cad893f467afd73179c43bf72f Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Fri, 21 Feb 2025 11:09:08 -0500 Subject: [PATCH 12/15] update register flag method names to match standardization, correct usage indentation, fix typo in request output flag --- cmd/request/request.go | 4 ++-- cmd/root.go | 4 ++-- internal/autocompletion/root_flags.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/request/request.go b/cmd/request/request.go index 8614b19c..0ef2c3c0 100644 --- a/cmd/request/request.go +++ b/cmd/request/request.go @@ -22,7 +22,7 @@ const ( Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment with JSON data sourced from a file. pingcli request --service pingone --http-method POST --data ./my-environment.json environments - Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment using raw JSON data. + Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment using raw JSON data. pingcli request --service pingone --http-method POST --data-raw '{"name": "My environment"}' environments Send a custom API request to the configured PingOne tenant, making a DELETE request to remove an application attribute mapping. @@ -65,7 +65,7 @@ The command offers a cURL-like experience to interact with the Ping platform ser // auto-completion err = cmd.RegisterFlagCompletionFunc(options.RequestServiceOption.CobraParamName, autocompletion.RequestServiceFunc) if err != nil { - output.SystemError(fmt.Sprintf("Unable to register auto completion for request flag %s: %v", options.RequestHTTPMethodOption.CobraParamName, err), nil) + output.SystemError(fmt.Sprintf("Unable to register auto completion for request flag %s: %v", options.RequestServiceOption.CobraParamName, err), nil) } return cmd diff --git a/cmd/root.go b/cmd/root.go index c397c70a..3ba859b2 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -56,7 +56,7 @@ func NewRootCommand(version string, commit string) *cobra.Command { // --profile, -P cmd.PersistentFlags().AddFlag(options.RootProfileOption.Flag) // auto-completion - err := cmd.RegisterFlagCompletionFunc(options.RootActiveProfileOption.CobraParamName, autocompletion_root_flags.Profile) + err := cmd.RegisterFlagCompletionFunc(options.RootActiveProfileOption.CobraParamName, autocompletion_root_flags.ProfileFunc) if err != nil { output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli global flag %s: %v", options.RootActiveProfileOption.CobraParamName, err), nil) } @@ -67,7 +67,7 @@ func NewRootCommand(version string, commit string) *cobra.Command { // --output-format, -O cmd.PersistentFlags().AddFlag(options.RootOutputFormatOption.Flag) // auto-completion - err = cmd.RegisterFlagCompletionFunc(options.RootOutputFormatOption.CobraParamName, autocompletion_root_flags.OutputFormat) + err = cmd.RegisterFlagCompletionFunc(options.RootOutputFormatOption.CobraParamName, autocompletion_root_flags.OutputFormatFunc) if err != nil { output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli global flag %s: %v", options.RootOutputFormatOption.CobraParamName, err), nil) } diff --git a/internal/autocompletion/root_flags.go b/internal/autocompletion/root_flags.go index 8ed07be6..baf3ff58 100644 --- a/internal/autocompletion/root_flags.go +++ b/internal/autocompletion/root_flags.go @@ -6,10 +6,10 @@ import ( "github.com/spf13/cobra" ) -func Profile(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { +func ProfileFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return profiles.GetMainConfig().ProfileNames(), cobra.ShellCompDirectiveNoFileComp } -func OutputFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { +func OutputFormatFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return customtypes.OutputFormatValidValues(), cobra.ShellCompDirectiveNoFileComp } From cb94c5ba5c8929e0f8413f190d56013e5744c71f Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Fri, 21 Feb 2025 14:02:59 -0500 Subject: [PATCH 13/15] root auto completion clean up --- cmd/root.go | 8 ++++---- internal/autocompletion/root_flags.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 3ba859b2..c3f34f7a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -10,7 +10,7 @@ import ( "github.com/pingidentity/pingcli/cmd/feedback" "github.com/pingidentity/pingcli/cmd/platform" "github.com/pingidentity/pingcli/cmd/request" - autocompletion_root_flags "github.com/pingidentity/pingcli/internal/autocompletion" + "github.com/pingidentity/pingcli/internal/autocompletion" "github.com/pingidentity/pingcli/internal/configuration" "github.com/pingidentity/pingcli/internal/configuration/options" "github.com/pingidentity/pingcli/internal/logger" @@ -56,9 +56,9 @@ func NewRootCommand(version string, commit string) *cobra.Command { // --profile, -P cmd.PersistentFlags().AddFlag(options.RootProfileOption.Flag) // auto-completion - err := cmd.RegisterFlagCompletionFunc(options.RootActiveProfileOption.CobraParamName, autocompletion_root_flags.ProfileFunc) + err := cmd.RegisterFlagCompletionFunc(options.RootProfileOption.CobraParamName, autocompletion.RootProfileFunc) if err != nil { - output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli global flag %s: %v", options.RootActiveProfileOption.CobraParamName, err), nil) + output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli global flag %s: %v", options.RootProfileOption.CobraParamName, err), nil) } // --no-color @@ -67,7 +67,7 @@ func NewRootCommand(version string, commit string) *cobra.Command { // --output-format, -O cmd.PersistentFlags().AddFlag(options.RootOutputFormatOption.Flag) // auto-completion - err = cmd.RegisterFlagCompletionFunc(options.RootOutputFormatOption.CobraParamName, autocompletion_root_flags.OutputFormatFunc) + err = cmd.RegisterFlagCompletionFunc(options.RootOutputFormatOption.CobraParamName, autocompletion.RootOutputFormatFunc) if err != nil { output.SystemError(fmt.Sprintf("Unable to register auto completion for pingcli global flag %s: %v", options.RootOutputFormatOption.CobraParamName, err), nil) } diff --git a/internal/autocompletion/root_flags.go b/internal/autocompletion/root_flags.go index baf3ff58..2a3b455f 100644 --- a/internal/autocompletion/root_flags.go +++ b/internal/autocompletion/root_flags.go @@ -6,10 +6,10 @@ import ( "github.com/spf13/cobra" ) -func ProfileFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { +func RootProfileFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return profiles.GetMainConfig().ProfileNames(), cobra.ShellCompDirectiveNoFileComp } -func OutputFormatFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { +func RootOutputFormatFunc(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return customtypes.OutputFormatValidValues(), cobra.ShellCompDirectiveNoFileComp } From 34632dfcf5eaa39da5c255545b16329fc96db3ea Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Fri, 21 Feb 2025 14:08:45 -0500 Subject: [PATCH 14/15] fix request command example spacing --- cmd/request/request.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/request/request.go b/cmd/request/request.go index 0ef2c3c0..1af92ae8 100644 --- a/cmd/request/request.go +++ b/cmd/request/request.go @@ -19,10 +19,10 @@ const ( Send a custom API request to the configured PingOne tenant, making a GET request to retrieve JSON configuration for a specific environment. pingcli request --service pingone --http-method GET --output-format json environments/$MY_ENVIRONMENT_ID - Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment with JSON data sourced from a file. + Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment with JSON data sourced from a file. pingcli request --service pingone --http-method POST --data ./my-environment.json environments - Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment using raw JSON data. + Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment using raw JSON data. pingcli request --service pingone --http-method POST --data-raw '{"name": "My environment"}' environments Send a custom API request to the configured PingOne tenant, making a DELETE request to remove an application attribute mapping. From f85419c2ecfbcfdf33d5995612a7d3d7f605383e Mon Sep 17 00:00:00 2001 From: wesleymccollam Date: Fri, 21 Feb 2025 14:46:03 -0500 Subject: [PATCH 15/15] fix request command example spacing --- cmd/request/request.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/request/request.go b/cmd/request/request.go index 1af92ae8..31d3c869 100644 --- a/cmd/request/request.go +++ b/cmd/request/request.go @@ -18,12 +18,12 @@ const ( Send a custom API request to the configured PingOne tenant, making a GET request to retrieve JSON configuration for a specific environment. pingcli request --service pingone --http-method GET --output-format json environments/$MY_ENVIRONMENT_ID - - Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment with JSON data sourced from a file. - pingcli request --service pingone --http-method POST --data ./my-environment.json environments + Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment with JSON data sourced from a file. + pingcli request --service pingone --http-method POST --data ./my-environment.json environments + Send a custom API request to the configured PingOne tenant, making a POST request to create a new environment using raw JSON data. - pingcli request --service pingone --http-method POST --data-raw '{"name": "My environment"}' environments + pingcli request --service pingone --http-method POST --data-raw '{"name": "My environment"}' environments Send a custom API request to the configured PingOne tenant, making a DELETE request to remove an application attribute mapping. pingcli request --service pingone --http-method DELETE environments/$MY_ENVIRONMENT_ID/applications/$MY_APPLICATION_ID/attributes/$MY_ATTRIBUTE_MAPPING_ID`