From 7d48bbd10d65fcfce241acf4b96743b903613922 Mon Sep 17 00:00:00 2001 From: Jamy Golden Date: Wed, 22 May 2024 12:47:24 +0200 Subject: [PATCH] Remove stderr comment output for `generate-completion` subcommand This doesn't serve much purpose so removing it --- CHANGELOG.md | 6 ++++++ USAGE.md | 12 ++++++++++++ src/main.rs | 2 +- tests/cli_generatecompletion_subcommand_tests.rs | 12 +----------- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b381fd2..efcbc28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased] + +### Changed + +- Remove stderr comment output for `tinty generate-completion` + ## [0.14.0] - 2024-05-07 ### Added diff --git a/USAGE.md b/USAGE.md index 09ef6f6..f34657c 100644 --- a/USAGE.md +++ b/USAGE.md @@ -21,6 +21,18 @@ subcommand, source the generated file in your shell startup file (`*rc`) and completions will exist for `tinty`. Have a look at the [README CLI section] for more information about the command usage. +```sh +tinty generate-completion zsh > path/to/tinty-zsh-completion.sh +``` + +In your startup file (`*rc`) add the following: + +```sh +source path/to/tinty-zsh-completion.sh +``` + +### Completions in the repo + A shell completion generation via `tinty` doesn't include any dynamic values, meaning scheme names (such as `base16-ocean`) won't be completed typing `tinty apply base`. We've created modified completion script diff --git a/src/main.rs b/src/main.rs index 39578c1..5ffc33b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -88,7 +88,7 @@ fn main() -> Result<()> { Some(("generate-completion", sub_matches)) => { if let Some(generator) = sub_matches.get_one::("shell_name") { let mut cmd = build_cli(); - eprintln!("Generating completion file for {generator}..."); + print_completions(*generator, &mut cmd); return Ok(()); }; diff --git a/tests/cli_generatecompletion_subcommand_tests.rs b/tests/cli_generatecompletion_subcommand_tests.rs index a5cd6f3..1cfe719 100644 --- a/tests/cli_generatecompletion_subcommand_tests.rs +++ b/tests/cli_generatecompletion_subcommand_tests.rs @@ -15,17 +15,7 @@ fn generate_shell_completion_test(shell_name: &str) -> Result { // --- // Act // --- - let (stdout, stderr) = utils::run_command(command_vec).unwrap(); - - // Ok((stdout, stderr, cleanup)) - - // ------ - // Assert - // ------ - assert!( - stderr.contains(format!("Generating completion file for {shell_name}...").as_str()), - "stderr does not contain the expected output" - ); + let (stdout, _) = utils::run_command(command_vec).unwrap(); cleanup()?; Ok(stdout)