feat: new flag options for cache#204
Merged
kevincobain2000 merged 7 commits intomasterfrom Sep 5, 2024
Merged
Conversation
CoverItUp Report
Commits HistoryUpto Users HistoryUpto |
CoverItUp ReportComparison Table - 7 Types 📈
Commits HistoryUpto Users HistoryUpto |
juev
commented
Sep 4, 2024
cmd/gobrew/main.go
Outdated
| _, ok = Find(allowedArgs, os.Args[1]) | ||
| if !ok { | ||
| return false | ||
| for i := range os.Args { |
Collaborator
Author
There was a problem hiding this comment.
Another thing, after switching to using a loop for checking, there is a problem with the command sequence. And such a sequence will be correct:
go run ./cmd/gobrew latest useI'll fix it
CoverItUp ReportComparison Table - 7 Types 📈
Commits HistoryUpto Users HistoryUpto |
CoverItUp ReportComparison Table - 7 Types 📈
Commits HistoryUpto Users HistoryUpto |
CoverItUp ReportComparison Table - 7 Types 📈
Commits HistoryUpto Users HistoryUpto |
CoverItUp ReportComparison Table - 7 Types 📈
Commits HistoryUpto Users HistoryUpto |
CoverItUp ReportComparison Table - 7 Types 📈
Commits HistoryUpto Users HistoryUpto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixed: #202
To implement the gobrew option, I had to use a third-party library called pflag.
Why? Because it handles positional arguments and flags properly.
For example:
If we use the standard flag, then
will call the ls command.
While in pflag the help will be called. Since this option was used.
A number of options have been added to the gobrew configuration. To manage the cache:
I also had to fix the behavior of the check for unavailable flags. We had an error in the check there.
And I slightly corrected the Find function. We used only one variable from the function output.
I checked locally a number of cases of using flags and options, launched in debug mode in order to check the correctness of filling the configuration. Everything seemed to be correct and without errors.
Maybe it's worth adding unit tests for these cases? I honestly don't really understand how to implement this yet.