Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add
common
platform to CLI #401Add
common
platform to CLI #401Changes from 4 commits
3ae95eb
14cd13f
f701773
ad6bb44
13b8d09
41d5161
71b35e3
0764eb7
e5038e4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We still have an occurrence of
"common"
in the code for listing all available pages which should be removed. Once this is done, one of our tests will fail that asserts that usingtldr --platform linux
actually checks both "linux" and "common" (for printing pages, as well as for listing them). So we should make sure to append "common" to the list of considered platforms here also in the case thatargs.platforms
isSome(_)
. It's fine if we cloneargs.platforms
for this.(the comments for listing pages also include mentions of the "common" platform, which should then be removed)
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.
Fair point :) I hope I found all special handlings now!
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.
The behavior for
--list
is correct now 👍 I had another implementation in mind though, sorry for not making this clear immediately!I think that now that we have the
Common
platform, we can move the "we will also check the common directory for pages" logic out ofCache
entirely - this is nice, because the cache shouldn't care about the choice of platforms, only about how to find pages for the given name, platform, etc.Thus, no method of
Cache
should make an exception for "common", it should just be treated like any other platform. The fact that we are still checking the "common" platform is business logic, it fits a lot better inmain
. I am imagining to replace the code around line 285 with something likesuch that in the end
platforms
is either a referencingfallback_platforms
orchosen_platforms
andchosen_platforms
hasCommon
appended, if it was not already present.This would also change the behavior for
tldr --platform linux tar
- right now, this would check only "linux", but the behavior of tealdeer 1.7 is to check both "linux" and "common". It seems that we are missing a test case for this, but it is definitely the expected behavior for the current version. If you are eager, you could also add a testcase for this inlib/tests.rs
around the other tests checking the--platform
lookup behavior (liketest_multiple_platform_command_search_not_found
andtest_multiple_platform_command_search
).Sorry that I am inflating this PR so much, if you want to hand it off at any point please let me know. Otherwise, I am very happy to keep working on this together! :)
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.
Nah its fine as long as you can live with a few days interruption here and there :)
Thank you very much for your thorough review! I hope I got it this time :)
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.
Oh yes, I might also not be able to do thorough reviews for longer times if other work is piling up, so no worries