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

Send all progress logging messages to stderr. #171

Merged
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
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn clear_cache(quietly: bool) {
process::exit(1);
});
if !quietly {
println!("Successfully deleted cache.");
eprintln!("Successfully deleted cache.");
}
}

Expand All @@ -178,7 +178,7 @@ fn update_cache(cache: &Cache, quietly: bool) {
process::exit(1);
});
if !quietly {
println!("Successfully updated cache.");
eprintln!("Successfully updated cache.");
}
}

Expand Down Expand Up @@ -245,7 +245,7 @@ fn show_paths() {
fn create_config_and_exit() {
match make_default_config() {
Ok(config_file_path) => {
println!(
eprintln!(
"Successfully created seed config file here: {}",
config_file_path.to_str().unwrap()
);
Expand Down Expand Up @@ -491,9 +491,9 @@ fn main() {
process::exit(0);
} else {
if !args.flag_quiet {
println!("Page {} not found in cache", &command);
println!("Try updating with `tldr --update`, or submit a pull request to:");
println!("https://github.com/tldr-pages/tldr");
eprintln!("Page {} not found in cache", &command);
eprintln!("Try updating with `tldr --update`, or submit a pull request to:");
eprintln!("https://github.com/tldr-pages/tldr");
}
process::exit(1);
}
Expand Down
21 changes: 8 additions & 13 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn test_update_cache() {
.args(&["--update"])
.assert()
.success()
.stdout(contains("Successfully updated cache."));
.stderr(contains("Successfully updated cache."));

testenv.command().args(&["sl"]).assert().success();
}
Expand Down Expand Up @@ -227,7 +227,7 @@ fn test_setup_seed_config() {
.args(&["--seed-config"])
.assert()
.success()
.stdout(contains("Successfully created seed config file"));
.stderr(contains("Successfully created seed config file here"));
}

#[test]
Expand Down Expand Up @@ -284,12 +284,7 @@ fn test_os_specific_page() {
fn test_markdown_rendering() {
let testenv = TestEnv::new();

testenv
.command()
.args(&["--update"])
.assert()
.success()
.stdout(contains("Successfully updated cache."));
testenv.add_entry("tar", include_str!("tar-markdown.expected"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻


let expected = include_str!("tar-markdown.expected");
testenv
Expand Down Expand Up @@ -410,7 +405,7 @@ fn test_spaces_find_command() {
.args(&["--update"])
.assert()
.success()
.stdout(contains("Successfully updated cache."));
.stderr(contains("Successfully updated cache."));

testenv
.command()
Expand All @@ -428,7 +423,7 @@ fn test_pager_flag_enable() {
.args(&["--update"])
.assert()
.success()
.stdout(contains("Successfully updated cache."));
.stderr(contains("Successfully updated cache."));

testenv
.command()
Expand Down Expand Up @@ -497,9 +492,9 @@ fn test_autoupdate_cache() {
let assert = testenv.command().args(&["--list"]).assert().success();
let pred = contains("Successfully updated cache");
if expected {
assert.stdout(pred)
assert.stderr(pred)
} else {
assert.stdout(pred.not())
assert.stderr(pred.not())
};
};

Expand Down Expand Up @@ -618,7 +613,7 @@ fn test_pager_warning() {
.args(&["--update"])
.assert()
.success()
.stdout(contains("Successfully updated cache."));
.stderr(contains("Successfully updated cache."));

// Regular call should not show a "pager flag not available on windows" warning
testenv
Expand Down