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

more: add arguments print over and clean print #4872

Merged

Conversation

Ideflop
Copy link
Contributor

@Ideflop Ideflop commented May 17, 2023

#2320

This pull request adds two arguments: -c, --print-over and -p, --clean-print.

I have included them in an if ... else if block because when both -c and -p are provided, it results in the --print-over options being applied.

@sylvestre
Copy link
Contributor

The test is failing:


--- TRY 3 STDERR:        coreutils::tests test_more::test_valid_arg ---
thread 'test_more::test_valid_arg' panicked at 'Command was expected to succeed.
stdout = 
 stderr = thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 6, kind: Uncategorized, message: "No such device or address" }', src/uu/more/src/more.rs:223:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
', tests/by-util/test_more.rs:15:27
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: tests::common::util::CmdResult::success
             at ./tests/common/util.rs:390:9
   3: tests::common::util::UCommand::succeeds
             at ./tests/common/util.rs:1559:9
   4: tests::test_more::test_valid_arg
             at ./tests/by-util/test_more.rs:15:5
   5: tests::test_more::test_valid_arg::{{closure}}
             at ./tests/by-util/test_more.rs:14:1
   6: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
   7: core::ops::function::FnOnce::call_once
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tail-2/inotify-dir-recreate. tests/tail-2/inotify-dir-recreate is passing on 'main'. Maybe you have to rebase?

#[test]
fn test_valid_arg() {
if std::io::stdout().is_terminal() {
new_ucmd!().arg("-c").succeeds().code_is(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

code_is(0) is not necessary, it's already implied by succeeds().

@cakebaker
Copy link
Contributor

While more -c file.txt works fine, more -p file.txt doesn't seem to work correctly. When I start paging, the content of the previous page(s) is not cleared.

@Ideflop
Copy link
Contributor Author

Ideflop commented May 20, 2023

I have corrected the behavior of the two commands because they were not functioning properly previously.
The command -c mistakenly cleared both the displayed text and its history instead of just deleting the currently displayed text.
The command -p now works correctly by taking the displayed text and adding it to the history. As a result, the terminal is emptied, allowing the remaining content to be printed.

@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail-2/inotify-dir-recreate is no longer failing!

@cakebaker cakebaker merged commit 70765ee into uutils:main May 20, 2023
@cakebaker
Copy link
Contributor

Thanks for your PR :)

@Ideflop Ideflop deleted the more_implement_print_over_and_clean_print branch May 20, 2023 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants