-
Notifications
You must be signed in to change notification settings - Fork 104
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
Added a liftoffrc config flag to only prompt on attributes with no specified default value #127
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,11 @@ def fetch_options | |
private | ||
|
||
def fetch_option_for(attribute, prompt) | ||
value = ask("#{prompt}? ") { |q| q.default = @configuration.public_send(attribute) } | ||
@configuration.public_send("#{attribute}=", value) | ||
default = @configuration.public_send(attribute) | ||
if !default || [email protected]_prompts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the same thing as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the |
||
value = ask("#{prompt}? ") { |q| q.default = default } | ||
@configuration.public_send("#{attribute}=", value) | ||
end | ||
rescue EOFError | ||
puts | ||
fetch_option_for(attribute, prompt) | ||
|
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.
Does this work? I thought we couldn't have hyphens in the flag? Or was that just for flags that take a value?
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.
Yes, it works for flags that already have a modifier. That's why it works for
--[no-]strict-prompts
but not for--indentation-level
.optparse
has some pretty eccentric parsing logic.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.
God that's stupid.