Closed st0012 closed 4 months ago
I love this. Anytime I try to teach someone they can use binding.irb
without a gem depencency to pry, I have to say "It's like Pry but..." and this removes one of the things on that list.
- "..", cd will leave the current context, moving back to the previous context.
I believe this is incorrect, based on both the assumption that this works similarly to cd ..
in a shell, and based on the code shown above (in a previous comment), which shows it 'popping' contexts (which normally means moving up a level, unless the 'popping' metaphor is also very different in irb
.) I've copied that code here:
when ".."
irb_context.pop_workspace
Popping does not necessarily take you to the previous workspace. You could be where you are because of using cd -
, in which case the next level up might not be the previous workspace.
Thanks for the great PR 💛
I hope this PR will be merged because I also used the cd
command in my .irbrc.
Currently, this PR doesn't support cd ../..
like pry.
I would like this feature. Do you have any plans to add it in the future?
Popping does not necessarily take you to the previous workspace. You could be where you are because of using cd -, in which case the next level up might not be the previous workspace.
It'll be the previous workspace on the same workspace stack. In this context, previous means the previous value that's been added to the stack (array). I know it's not perfectly accurate, but I can't think of better description for it and I'm open to better ideas 🙂
I would like this feature. Do you have any plans to add it in the future?
Unfortunately I don't plan to introduce nested syntax atm, such as cd @x/@y
like Pry does. In the similar sense, I won't introduce multi-level exits yet.
I couldn't 100% replicate Prys' cd -
behaviour without making huge changes, which is against my goal to build a nicer interface based on the current implementation. Even if I were allowed to cut a few corners and deliver a simpler version of it, I wouldn't know where to cut and what to keep as I personally am not a user 😅
So I decided to drop it from the current PR and ship what we have first. If you really want to see cd -
, please open an issue and describe the desire behaviour in details. Thanks 🙂
It's essentially a combination of
pushws
andpopws
commands that are easier to use.Help message:
Please note that it's not a replica of Pry's
cd
command as it doesn't support the/
argument, nor complicated navigation syntax.