-
Notifications
You must be signed in to change notification settings - Fork 55
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
Optional arguments #109
Optional arguments #109
Conversation
Thanks for the PR! I plan on reviewing it sometime within the next few days/week when I find the time. Mask is definitely still in development! I just rarely find time to work on it and in its current form it solves 99% of my day to day needs. Optional args I've wanted for a long time and it just never became a high priority, so I'm looking forwards to getting this reviewed and merged 🙂 |
Hey, I did a very quick review and looked into that CI php error with a suggestion on how to fix it properly. I also noticed the actions didn't run on this PR so I'm hoping once you commit some updates they'll re-run correctly. |
Thanks for getting up to date with master! I haven't forgot about this, just been really busy lately. I plan on checking this out again this week 👍 |
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.
@jpal91 the PR looks great! Just the one comment about the macOS runner needing to be reverted so that CI can pass.
After that, will approve and merge!
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.
Looks great! I'll merge today and plan on cutting a new release in the next week or so.
Which issue does this fix?
Closes #5
Hello! I discovered this package recently, and I'm a big fan! I was hoping that optional arguments were possible, but saw that there was an issue referencing that hadn't been touched in a while.
I'm not sure if this project is in active development anymore so I decided to implement it based on what I saw in the issue and share it with the community if you're still interested!
Describe the solution
mask-parser
This was the bulk of the change. I altered the
parse_command_name...
function inparser.rs
to look for both parenthesis and brackets. It uses similar logic as before (splitting the string) and essentially just does it twice. It now returns the new structOptionalArg
along with the previous return values.Additional Changes:
OptionalArg
which is identical toRequiredArg
parse
function to accept new values from aforementioned functionparser.rs
to include new fieldoptional_args
mask
required_args
and mirrored an additional loop foroptional_args
main::get_command_options
unwraps to an emptystr
instead of panicking, making it optionaloptional_args
added to the jsonOther notes
maskfile
doesn't matter with this implementation which could lead to some weirdness but may be desirable to some? Regardless, with a little additional logic it could be altered