From 62a92c1998dc7ff4cc35a20cc4d62c2148bade0d Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 28 Sep 2023 20:24:08 +0200 Subject: [PATCH] env: add use to completions --- pkg/actions/env/aws.go | 25 ++++++++++++++++++------- pkg/actions/env/env.go | 4 ++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/pkg/actions/env/aws.go b/pkg/actions/env/aws.go index 867f164c30..0e6bc871b3 100644 --- a/pkg/actions/env/aws.go +++ b/pkg/actions/env/aws.go @@ -24,8 +24,8 @@ func init() { "AWS_DEFAULT_OUTPUT": "Specifies the output format to use", "AWS_DEFAULT_REGION": "The Default region name", "AWS_EC2_METADATA_DISABLED": "Disables the use of the Amazon EC2 instance metadata service (IMDS)", - "AWS_ENDPOINT_URL": "Specifies the endpoint that is used for all service requests", // "AWS_ENDPOINT_URL_": "pecifies a custom endpoint that is used for a specific service, where is replaced with the AWS service identifier. For example, Amazon DynamoDB has a serviceId of DynamoDB. For this service, the endpoint URL environment variable is AWS_ENDPOINT_URL_DYNAMODB. + "AWS_ENDPOINT_URL": "Specifies the endpoint that is used for all service requests", "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS": "If enabled, the AWS CLI ignores all custom endpoint configurations", "AWS_MAX_ATTEMPTS": "Specifies a value of maximum retry attempts the AWS CLI retry handler uses", "AWS_METADATA_SERVICE_NUM_ATTEMPTS": "retry multiple times before giving up", @@ -42,22 +42,33 @@ func init() { "AWS_WEB_IDENTITY_TOKEN_FILE": "Specifies the path to a file that contains an OAuth 2.0 access token", }, VariableCompletion: map[string]carapace.Action{ - "AWS_CA_BUNDLE": carapace.ActionFiles(), + "AWS_ACCESS_KEY_ID": carapace.ActionValues(), + "AWS_CA_BUNDLE": carapace.ActionFiles(), "AWS_CLI_AUTO_PROMPT": carapace.ActionValuesDescribed( "on", "full auto-prompt mode each time you attempt to run an aws command", "on-partial", "partial auto-prompt mode", ).StyleF(style.ForKeyword), - "AWS_CONFIG_FILE": carapace.ActionFiles(), - "AWS_DATA_PATH": carapace.ActionDirectories().List(string(os.PathListSeparator)), - "AWS_DEFAULT_OUTPUT": aws.ActionOutputFormats(), - "AWS_DEFAULT_REGION": aws.ActionRegions(), - "AWS_EC2_METADATA_DISABLED": _bool, + "AWS_CLI_FILE_ENCODING": carapace.ActionValues(), // TODO encodings + "AWS_CONFIG_FILE": carapace.ActionFiles(), + "AWS_DATA_PATH": carapace.ActionDirectories().List(string(os.PathListSeparator)), + "AWS_DEFAULT_OUTPUT": aws.ActionOutputFormats(), + "AWS_DEFAULT_REGION": aws.ActionRegions(), + "AWS_EC2_METADATA_DISABLED": _bool, + "AWS_ENDPOINT_URL": carapace.ActionValues(), + // "AWS_ENDPOINT_URL_": carapace.ActionValues(), // TODO "AWS_IGNORE_CONFIGURED_ENDPOINT_URLS": _bool, + "AWS_MAX_ATTEMPTS": carapace.ActionValues(), + "AWS_METADATA_SERVICE_NUM_ATTEMPTS": carapace.ActionValues(), + "AWS_METADATA_SERVICE_TIMEOUT": carapace.ActionValues(), "AWS_PAGER": bridge.ActionCarapaceBin().Split(), "AWS_PROFILE": aws.ActionProfiles(), "AWS_REGION": aws.ActionRegions(), "AWS_RETRY_MODE": carapace.ActionValues("legacy", "standard", "adaptive"), + "AWS_ROLE_ARN": carapace.ActionValues(), + "AWS_ROLE_SESSION_NAME": carapace.ActionValues(), + "AWS_SECRET_ACCESS_KEY": carapace.ActionValues(), "AWS_SHARED_CREDENTIALS_FILE": carapace.ActionFiles(), + "AWS_USE_FIPS_ENDPOINT": carapace.ActionValues(), "AWS_WEB_IDENTITY_TOKEN_FILE": carapace.ActionFiles(), }, } diff --git a/pkg/actions/env/env.go b/pkg/actions/env/env.go index 09ce37e894..3b98b79eab 100644 --- a/pkg/actions/env/env.go +++ b/pkg/actions/env/env.go @@ -107,14 +107,14 @@ func ActionEnvironmentVariableValues(s string) carapace.Action { if custom.Condition == nil || custom.Condition(c) { if action, ok := custom.VariableCompletion[s]; ok { found = true - return action + return action.Usage(custom.Variables[s]) } } for _, v := range knownVariables { if action, ok := v.VariableCompletion[s]; ok { found = true - return action + return action.Usage(v.Variables[s]) } } return carapace.ActionValues()