Uh oh!
There was an error while loading. Please reload this page.
Update README.md to show multiple commands execution using binding.b - #828
Conversation
ko1
commented
Nov 24, 2022
For the |
| 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.
I'm not sure why this added block is needed.
There was a problem hiding this comment.
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.
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,
debuggerdo: 'watch @a'debuggerdo: 'break foo pre: info'# ordebuggerdo: <<~DO watch @a break foo pre: infoDOis more readable for me.
(I usually use ;; for writability/easy to write, though)
There was a problem hiding this comment.
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.
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 😄
ko1
commented
Nov 24, 2022
But it is already documented...
So I can accept to describe about it (first part of this patch) |
binarygit
commented
Nov 25, 2022
if the |
st0012
commented
Nov 25, 2022
IMO, it's not very clear that
I assume we can still write multiple commands in the same line? Like |
ko1
commented
Nov 25, 2022
+1
Yes, but not sure it is readable. |
st0012
commented
Nov 28, 2022
I think this feature has 2 types of usages:
For 2), I think newline separator does help: debuggerdo: <<~DO watch @a break foo pre: infoDOBut 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 |
binarygit
commented
Nov 30, 2022
I agree with @st0012 |
606d187 to
f964543Compare
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
preanddoarguments 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!