-
Notifications
You must be signed in to change notification settings - Fork 120
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
Add edit command #453
Merged
Merged
Add edit command #453
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
02e3d69
to
ff6af14
Compare
k0kubun
reviewed
Nov 19, 2022
k0kubun
approved these changes
Nov 19, 2022
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 merged #451. Let's add edit
to it too 👍
k0kubun
reviewed
Nov 19, 2022
ff6af14
to
b54e32f
Compare
b54e32f
to
d7a58f4
Compare
k0kubun
reviewed
Nov 20, 2022
k0kubun
reviewed
Nov 20, 2022
k0kubun
approved these changes
Nov 20, 2022
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.
🎉
matzbot
pushed a commit
to ruby/ruby
that referenced
this pull request
Nov 20, 2022
* Add edit command * Make find_source a public singleton method * Add document for the edit command * Make find_end private * Remove duplicated private ruby/irb@4321674aa7 Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Name
I originally wanted to name it
open
. But sinceruby/debug
has anedit
command (the inspiration of this feature), I think it's better to match it.Usages
Editor is determined by
ENV["EDITOR"]
edit
- opens the current context's file in the editoredit foo.rb
- opensfoo.rb
in the editor if it existsIt also supports
show_source
compatible arguments, likeedit Foo
edit Foo#bar
edit Foo.baz
In these cases, it'll use
show_source
to resolve the argument's path and open them in the editor.Exceptions
irb
can't find a file with the argument, nor canShowSource#find_source
resolve its source, it prints a message and stops.ENV["EDITOR"]
is not defined, the command also prints a message and stops.