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

Support for ignored-suffix CLI arguments #1892

Merged
merged 17 commits into from
Nov 19, 2021

Conversation

bojan88
Copy link
Contributor

@bojan88 bojan88 commented Oct 9, 2021

Implements #1824

@bojan88 bojan88 marked this pull request as draft October 9, 2021 19:49
@bojan88 bojan88 marked this pull request as ready for review October 9, 2021 21:12
src/assets.rs Outdated Show resolved Hide resolved
@bojan88 bojan88 marked this pull request as draft October 11, 2021 19:58
Copy link
Contributor Author

@bojan88 bojan88 left a comment

Choose a reason for hiding this comment

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

@Enselic please take a look again when you have time.
I reverted some public API changes, and I'm passing config around.

From what I understand, we'll need to deprecate a few more functions here and add new versions. I can update that once you give go-ahead, but until then, I'll leave this as a draft.

src/assets.rs Outdated Show resolved Hide resolved
src/assets.rs Outdated Show resolved Hide resolved
@bojan88 bojan88 marked this pull request as ready for review October 31, 2021 01:01
src/assets.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@Enselic
Copy link
Collaborator

Enselic commented Nov 1, 2021

Again, thanks for working on this. I left som high level comments.

Another thing that would be great to iterate on early is the CLI for this. Could you add a single test to tests/integration_tests.rs that uses the new CLI please? Once we agree on the CLI we can iterate on the implementation.

@bojan88
Copy link
Contributor Author

bojan88 commented Nov 4, 2021

Sorry for the delay. I'll convert this to draft until I find time to work on it. @Enselic it would be awesome if you could give me an example where to put files for integration test, and how many. Otherwise I can come up with something, and we can reiterate from that. Thanks, I appreciate yor reviews

@bojan88 bojan88 marked this pull request as draft November 4, 2021 19:43
@bojan88 bojan88 marked this pull request as ready for review November 6, 2021 22:22
@bojan88
Copy link
Contributor Author

bojan88 commented Nov 6, 2021

This should be ready for review.
Let me know please in case I should add more changes.
And please make sure I haven't messed up public API, because I'm not aware what exactly is exposed there.

Copy link
Collaborator

@Enselic Enselic left a comment

Choose a reason for hiding this comment

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

I skimmed it over again, and it already looks much better! Thanks!

I have a couple of more high level comments.

I expect to get time for a detailed review in a not too distant future. Would be great if you could take care of high level comments in the meantime.

src/syntax_mapping.rs Outdated Show resolved Hide resolved
src/syntax_mapping.rs Outdated Show resolved Hide resolved
src/ignored_suffixes.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Enselic Enselic left a comment

Choose a reason for hiding this comment

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

Some more comments. Still pretty high level. I really like the direction we're heading in.

I hope you don't mind this style of code review; writing what comes to mind as I get some time over to look at the code in more and more detail.

src/assets.rs Outdated Show resolved Hide resolved
src/ignored_suffixes.rs Outdated Show resolved Hide resolved
tests/integration_tests.rs Show resolved Hide resolved
@bojan88
Copy link
Contributor Author

bojan88 commented Nov 8, 2021

Some more comments. Still pretty high level. I really like the direction we're heading in.

I hope you don't mind this style of code review; writing what comes to mind as I get some time over to look at the code in more and more detail.

Not at all. I really appreciate your patience and suggestions, and always thinking "I should've seen this on my own".
I guess it's because of my lack of fully understanding the structure of the project.

Copy link
Collaborator

@Enselic Enselic left a comment

Choose a reason for hiding this comment

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

Another review round. Unless I missed something, I can Approve this PR after the last comments are fixed.

But I reserve the right to find more things to comment on in the next review round :)

Also, don't forget to add yourself to CHANGELOG.md

src/assets.rs Outdated Show resolved Hide resolved
src/bin/bat/app.rs Outdated Show resolved Hide resolved
src/syntax_mapping.rs Outdated Show resolved Hide resolved
src/syntax_mapping.rs Show resolved Hide resolved
tests/integration_tests.rs Show resolved Hide resolved
src/ignored_suffixes.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Enselic Enselic left a comment

Choose a reason for hiding this comment

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

I feel done with reviewing now, because:

  • Public API for bat-as-a-library looks good
  • CLI looks good
  • Regression tests exists

I'm not that picky with the code for the implementation since that can easily be tweaked later as long as regression tests are in place. The only thing that's hard to tweak is the public interfaces, both library-wise and CLI-wise. But again, those look good to me now.

I don't know of a simple way to diff public APIs between commits. But if I use my home-cooked method, which is:

% git checkout master
% RUSTDOCFLAGS='-Z unstable-options --output-format json' cargo +nightly doc --no-deps
% jq  '.index | .[] | select(.crate_id == 0) | .name' target/doc/bat.json | sort > /tmp/api-master

% git checkout ignored-suffix-arg
% RUSTDOCFLAGS='-Z unstable-options --output-format json' cargo +nightly doc --no-deps
% jq  '.index | .[] | select(.crate_id == 0) | .name' target/doc/bat.json | sort > /tmp/api-new

The only change in the API is the addition of the new function we added:

% diff -u /tmp/api-master /tmp/api-new
--- /tmp/api-master	2021-11-13 14:30:52.544066658 +0100
+++ /tmp/api-new	2021-11-13 14:31:42.940187393 +0100
@@ -142,6 +142,7 @@
 "input_stdin"
 "InRange"
 "insert"
+"insert_ignored_suffix"
 "InvalidPagerValueBat"
 "Io"
 "is_compatible_with"

so everything seems to be in order in that regard.

Approved!

I will leave this open for some time to give other maintainers a chance to review. CC: @sharkdp @keith-hall

@Enselic
Copy link
Collaborator

Enselic commented Nov 17, 2021

@sharkdp @keith-hall Not sure if you saw my ping, so just wanted to let you know that I intend to merge this early next week. Let me know if you would like more time to review. See #1892 (review) for my "final words" on this PR.

@keith-hall
Copy link
Collaborator

Looks awesome to me - nice work!

.number_of_values(1)
.multiple(true)
.takes_value(true)
.long("ignored-suffix")
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should consider making this .hidden_short_help(true), such that we only show it on bat --help, but not for bat -h (which should only show the most commonly used options).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @sharkdp for explanation.
It's updated.

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

I agree - thank you very much for your contribution. I have just one minor remark.

@Enselic
Copy link
Collaborator

Enselic commented Nov 19, 2021

I have confirmed that the most recent commit made --ignored-suffix only be printed with --help but not -h.

Since all active maintainers have approved this PR I see no point in waiting until the beginning of next week to merge.

Merging! 🎉

@Enselic Enselic merged commit d6ed5e6 into sharkdp:master Nov 19, 2021
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.

4 participants