diff --git a/.changeset/dull-bottles-try.md b/.changeset/dull-bottles-try.md new file mode 100644 index 0000000..5e3cab6 --- /dev/null +++ b/.changeset/dull-bottles-try.md @@ -0,0 +1,5 @@ +--- +"fnm": patch +--- + +fix: panic on `fnm completions` diff --git a/src/commands/completions.rs b/src/commands/completions.rs index 9f4a335..e4726ee 100644 --- a/src/commands/completions.rs +++ b/src/commands/completions.rs @@ -24,7 +24,8 @@ impl Command for Completions { .or_else(|| infer_shell().map(Into::into)) .ok_or(Error::CantInferShell)?; let shell: ClapShell = shell.into(); - let app = Cli::command(); + let mut app = Cli::command(); + app.build(); shell.generate(&app, &mut stdio); Ok(()) } @@ -49,3 +50,18 @@ fn shells_as_string() -> String { .collect::>() .join("\n") } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + #[cfg(not(windows))] + fn test_smoke() { + let config = FnmConfig::default(); + Completions { + shell: Some(Shells::Bash), + } + .call(config); + } +}