-
Notifications
You must be signed in to change notification settings - Fork 476
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 confirm prompt #1834
Add confirm prompt #1834
Conversation
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! Check out the review comments. If you feel like it, also take a crack at documenting this in the readme.
I will document it in the README.md later today (I expect) EDIT: Done. |
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.
Nice, looks good, check out my review comments.
src/parser.rs
Outdated
let arguments = if self.accepted(ParenL)? { | ||
let mut arguments = Vec::new(); | ||
|
||
while self.next_is(StringToken) { |
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.
Actually, we only have one attribute that accepts a string literal, and if we're accepting multiple arguments, we would want to accept commas between them, so we can make arguments
be an Option
.
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.
Comma-separated arguments are now accepted, do should comma+space also be accepted?
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.
Ah, no sorry, what I was getting at is that we don't have any multi-argument attributes, so we shouldn't bother either with parsing multiple arguments, with or without commas. We can just parse ( STRING )
.
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.
Alright, but now it is implemented, do you want it removed? It's like 2 lines and all the scaffolding is there now if there's a need/want for features that take advantage of recipe attributes with arguments. Off the top of my head it could be stuff like [linux("arm64", "amd64")]
that enables recipes based on OS + Architecture, or adding kernel version for requirements etc.
But I respect if you invoke YAGNI, then I'll revert it.
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.
I agree we'll probably add it later, but that could be a while, so I'd assume just remove it. It also makes Attribute::with_arguments
simpler, since it can take an Option
instead of a Vec
.
I made some semi-related changes to Now the |
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.
Added some comments.
Merged! Thank you very much! This release is turning out to have a lot of great contributions ^_^ |
Add functionality to allow specifying a prompt for the
confirm
recipe attribute.e.g.
[confirm("this recipe is dangerous because blabla")]
It's a quick and dirty implementation, feel free to nitpick. And thanks a lot for your great work!