fix: Corrected tab completions for the provider flag
This commit is contained in:
@@ -280,6 +280,27 @@ pub fn run_config_completer(current: &OsStr) -> Vec<CompletionCandidate> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn provider_completer(current: &OsStr) -> Vec<CompletionCandidate> {
|
||||||
|
let cur = current.to_string_lossy();
|
||||||
|
match load_config() {
|
||||||
|
Ok(config) => {
|
||||||
|
config.providers
|
||||||
|
.iter()
|
||||||
|
.filter(|pc| {
|
||||||
|
pc.name
|
||||||
|
.as_ref()
|
||||||
|
.expect("run config has no name")
|
||||||
|
.starts_with(&*cur)
|
||||||
|
})
|
||||||
|
.map(|pc| {
|
||||||
|
CompletionCandidate::new(pc.name.as_ref().expect("provider has no name"))
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
Err(_) => vec![],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn secrets_completer(current: &OsStr) -> Vec<CompletionCandidate> {
|
pub fn secrets_completer(current: &OsStr) -> Vec<CompletionCandidate> {
|
||||||
let cur = current.to_string_lossy();
|
let cur = current.to_string_lossy();
|
||||||
match load_config() {
|
match load_config() {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use crate::cli::provider_completer;
|
||||||
use crate::cli::run_config_completer;
|
use crate::cli::run_config_completer;
|
||||||
use crate::cli::secrets_completer;
|
use crate::cli::secrets_completer;
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
@@ -51,7 +52,7 @@ struct Cli {
|
|||||||
output: Option<OutputFormat>,
|
output: Option<OutputFormat>,
|
||||||
|
|
||||||
/// Specify the secret provider to use (defaults to 'default_provider' in config (usually 'local'))
|
/// Specify the secret provider to use (defaults to 'default_provider' in config (usually 'local'))
|
||||||
#[arg(long, global = true, env = "GMAN_PROVIDER", value_parser = ["local", "aws_secrets_manager", "azure_key_vault", "gcp_secret_manager", "gopass"])]
|
#[arg(long, global = true, env = "GMAN_PROVIDER", add = ArgValueCompleter::new(provider_completer))]
|
||||||
provider: Option<String>,
|
provider: Option<String>,
|
||||||
|
|
||||||
/// Specify a run profile to use when wrapping a command
|
/// Specify a run profile to use when wrapping a command
|
||||||
|
|||||||
Reference in New Issue
Block a user