Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove stderr comment output for generate-completion subcommand #27

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Changed

- Remove stderr comment output for `tinty generate-completion`

## [0.14.0] - 2024-05-07

### Added
Expand Down
12 changes: 12 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn main() -> Result<()> {
Some(("generate-completion", sub_matches)) => {
if let Some(generator) = sub_matches.get_one::<Shell>("shell_name") {
let mut cmd = build_cli();
eprintln!("Generating completion file for {generator}...");

print_completions(*generator, &mut cmd);
return Ok(());
};
Expand Down
12 changes: 1 addition & 11 deletions tests/cli_generatecompletion_subcommand_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,7 @@ fn generate_shell_completion_test(shell_name: &str) -> Result<String> {
// ---
// 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)
Expand Down