-
Notifications
You must be signed in to change notification settings - Fork 129
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
Update README.md to show multiple commands execution using binding.b #828
Update README.md to show multiple commands execution using binding.b #828
Conversation
For the |
misc/README.md.erb
Outdated
@@ -586,6 +586,22 @@ end | |||
|
|||
On this case, you can see the result of `bar()` every time you stop there. | |||
|
|||
You can use `pre` and `do` together to create more useful workflows. |
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'm not sure why this added block is needed.
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.
It wasn't very obvious to me, how I would achieve something like this. I think the technique used is handy in alot of situations but as I said, it wasn't obvious how I would go about doing it. So, I think it's useful to have this documented here.
I would have never thought that
binding.b do: 'watch @a ;; break foo pre: info'
the pre
inside the string above would be evaluated correctly, like an argument to a binding.b
and thus suspend the program. I would have never thought this would work, so I think it's worth documenting.
But If I missed something in the README that does suggest that this is possible and I missed it, please let me know 😄
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'm curious why it is not clear without explanation. do:
accepts debug command string (described) and break foo pre: info
is debug command.
BTW, on this case,
debugger do: 'watch @a'
debugger do: 'break foo pre: info'
# or
debugger do: <<~DO
watch @a
break foo pre: info
DO
is more readable for me.
(I usually use ;;
for writability/easy to write, though)
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! I went through the docs again and see clearly that you have it there.
Sorry, I should have been more thorough!
I will remove the block from my PR.
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 updated my PR removing the above block and I added a sentence about how users can use ;;
instead of \n
.
I think this will do, no?
Let me know if you want me to add something else.
Also hope ;;
stays around 😄
But it is already documented...
So I can accept to describe about it (first part of this patch) |
if the |
IMO, it's not very clear that
I assume we can still write multiple commands in the same line? Like |
+1
Yes, but not sure it is readable. |
I think this feature has 2 types of usages:
For 2), I think newline separator does help: debugger do: <<~DO
watch @a
break foo pre: info
DO But it's not convenient for 1) as we now need to copy and paste multiple lines instead of just one. Typing Another thing to consider is that |
I agree with @st0012 |
606d187
to
f964543
Compare
Description
Describe your changes:
This addition to the README.md demonstrates how to specify multiple commands to run when using
binding.b
.I didn't think it obvious that you needed to have two semicolons separating the commands (
cmd 1 ;; cmd 2
). The README does not document this which is why I thought I would add it there.I've also added an example to demonstrate how you could use
pre
anddo
arguments together to create a more advanced/useful workflow.P.S. I wouldn't have known how to do both of the above things if it hadn't been for @st0012 Ruby Kaigi talk on debugging. So Thank You for that!