-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Rewrite more #2109
Rewrite more #2109
Conversation
please let me know when it is ready but it is great to see such progress here :) |
Sure. I would try to complete it ASAP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am aware that it is a draft but here are some initial feedback ;)
Thanks for telling me that. I would change it in further commits |
I have rewrote the basic usable version of more. Although none of the CLI flags are actually implemented and I will address them in a future PR. I think that this PR should be merged before I start working on the CLI part. I see there's a merge conflict which I will resolve probably by tomorrow and squash everything so that we could merge this |
This PR is ready for merging. If you have any suggestions, you can comment it down here. I will address them in my next PR |
Seems that a test is failing on Windows:
|
Add crossterm as dependency Complete the paging portion Fixed tests cp: extract linux COW logic into function cp: add --reflink support for macOS Fixes #1773 Fix error in Cargo.lock Quit automatically if not much output is left Remove unnecessary redox and windows specific code Handle line wrapping Put everything according to uutils coding standards Add support for multiple files Fix failing test Use the args argument to get cli arguments Fix bug where text is repeated multiple times during printing Add a little prompt Add a top file prompt for multiple files Change println in loops to stdout.write and setup terminal only once Fix bug where all lines were printed in a single row Remove useless file and fix failing test Fix another test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it builds fine and bravo for the tests
However:
- more without any arguments cannot be exited?!
Gnu is returning:
LANG=C more
more: bad usage
Try 'more --help' for more information.
-
more is breaking the display of the terminal (
reset
is needed to come back in a normal state) -
more Makefile. the content isn't rendered correctly.
For example on my system
USEGNU=gmake $*
all:
@$(USEGNU)
.DEFAULT:
@$(USEGNU)
% ╭─sylvestre@pinasil ~/dev/debian/coreutils ‹master*›
╰─$
./target/release/coreutils more non-existing
is failing with:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /home/sylvestre/dev/debian/coreutils/src/uu/more/src/more.rs:148:63
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I think, your issues are probably fixed in the last commit, you could review it again and report if anything goes wrong |
src/uu/more/src/more.rs
Outdated
stdin().read_to_string(&mut buff).unwrap(); | ||
more(&buff, &mut stdout, true); | ||
} else { | ||
show_usage_error!("bad usage"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad usage? This is the error that GNU is reporting?
It still breaks the terminal for me. Example with zsh & gnome-terminal:
|
Sorry but did you test your change?
|
I fixed the issue with broken terminal. Could you recheck that. |
Could you decrease the minimal version of crossterm, it fails to build with Rust 1.40 with:
|
Sure. I will check that. This might take some time as I would probably have to go through a hit and trial process |
To test |
Besides that, it looks great :) |
I have downgraded the minimum version of crossterm and everything compiles correctly with Rust 1.40. |
This rewrite is awesome! Sadly, I'm getting some errors on my machine:
These seem to be caused by a bug in Apart from this error, really nice job, it looks great when I use the recent versions of @sylvestre Do you think we could set the MSRV to 1.43 to use |
I've fixed some things up and I think this can be merged now (if the CI is green). There are a couple of remaining issues that should be dealt with in other PR's:
I'll create issues for these once this is merged. @arijit79 This PR is amazing, thanks! |
The more utility seems fairly incomplete. It does not use any modern terminal library like crossterm or termion Reading from standard input is also not implemented along with other flags that are present in the original GNU
more
. This PR intends to rewritemore
usingcrossterm
, adding all the missing flags and making it as close to the original more as possibleThere are few differences in the command line interface from the original more like not having the + and - symbols in the
-<number>
,+<number>
and+/<pattern>
options from the original more. This is due to the non-standard way of arguments in GNU more, whichclap
does not allow building