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 implement argument pattern #5966

Merged
merged 3 commits into from
Mar 21, 2024

Conversation

Ideflop
Copy link
Contributor

@Ideflop Ideflop commented Feb 10, 2024

This implements the Pattern option to more.

I put this as a draft for now, because the implementation is not as the one from gnu more. The implementation was discussed on the discord server, but it has been 6 months since then I don't know if anything has changed.

Currently more does this:

Before displaying each file, more searches for the pattern. If the pattern is not found, it displays the message "Pattern not found." Otherwise, it displays the file starting from the pattern match.

@Ideflop Ideflop marked this pull request as draft February 10, 2024 22:25
@Ideflop
Copy link
Contributor Author

Ideflop commented Feb 10, 2024

Some checks are failing with the message "error: the compiler unexpectedly panicked. this is a bug."

However, I am unable to reproduce this bug

Edit: I updated my Rust toolchain and now I get the error when running cargo +nightly clippy --workspace --all-targets --all-features --.

Should I open an issue on the Rust lang repository?

@tertsdiepraam
Copy link
Member

If there are no issues for it already, that would be great, especially if you can figure which crate triggers the ICE.

@cakebaker
Copy link
Contributor

I guess it is the following issue: rust-lang/rust#120909

@Ideflop Ideflop marked this pull request as ready for review March 10, 2024 21:10
@Ideflop
Copy link
Contributor Author

Ideflop commented Mar 10, 2024

Sorry, I forgot I had it in Drafts. I believe it's ready for review.

The compilation issue was also resolved by reverting the commit that introduced the problem: rust-lang/rust#121167

@sylvestre sylvestre force-pushed the more-implement-argument-pattern branch from 24b2d3e to a227af7 Compare March 10, 2024 21:14
@tertsdiepraam
Copy link
Member

tertsdiepraam commented Mar 12, 2024

I forgot what we already discussed 6 months ago so I might be rehashing stuff, but I can't find this feature in util-linux more, is that correct? This is a nice feature and more doesn't strictly have to follow util-linux in my opinion (because it's not a coreutil), but I want to make sure that we know that we are extending it. There is the +/<pattern> argument, which does the same thing but with a different syntax.

@Ideflop
Copy link
Contributor Author

Ideflop commented Mar 13, 2024

Yes, this implements the +/<pattern> argument from the more command.
Currently, Clap doesn't support non-Unix options. There is an issue open at clap-rs/clap#2468.

Therefore, I used what was given in #2320

@tertsdiepraam
Copy link
Member

Ah it's my fault then 😄

I think this is a good idea for now. It's nice to at least have the functionality.

@cakebaker cakebaker merged commit 77a6755 into uutils:main Mar 21, 2024
62 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR :)

@Ideflop Ideflop deleted the more-implement-argument-pattern branch March 21, 2024 22:41
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