-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Read Prompt Support #722
Read Prompt Support #722
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.
Appreciated! Just one comment to simplify the flag parsing logic.
interp/builtin.go
Outdated
@@ -538,6 +544,14 @@ func (r *Runner) builtinCode(ctx context.Context, pos syntax.Pos, name string, a | |||
} | |||
} | |||
|
|||
if prompt.provided { | |||
if prompt.message == "" { |
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.
you could make this check inside case "-p"
, then you don't need provided
at all - you'd just do message != ""
.
and you could also just do message := ""
; I don't think the struct is necessary
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.
Ok gotcha, making the change 👍
@mvdan I left the |
Hey @mvdan 👋
I have implemented the
read -p
flag, as requested in issue #551. Included are new test cases to cover the added feature, as well as the integration of-p
with the existing code that handlesread
. All test cases old and new are passing.Let me know if there are any changes still needed, and thanks for your hard work maintaining this library!