From aa595dd6291ed9e1db71a60dd021a59369a81868 Mon Sep 17 00:00:00 2001 From: Swarnim Arun Date: Thu, 4 Jan 2024 16:15:31 +0530 Subject: [PATCH] fix: use env for shell detection --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index bc5210a9b..64b4d0dc8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,7 +62,7 @@ enum SubCommands { #[derive(Parser)] struct ShellCompletion { #[arg(short, long)] - shell: clap_complete::Shell, + shell: Option, } #[derive(Parser)] @@ -285,6 +285,9 @@ async fn main() -> miette::Result<()> { &mut std::io::stdout(), ); } + let shell = shell + .or(clap_complete::Shell::from_env()) + .unwrap_or(clap_complete::Shell::Bash); print_completions(shell, &mut cmd); Ok(()) }