ruby / ruby/irb

Load edited file after `edit` command

Open
#1,099 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
478
Forks
158
Avg merge
1d 12h
Merged PRs (30d)
12

Description

We have edit command which invokes a text editor from IRB. This is convenient when we launch IRB with bin/console command so that we can modify a bit of code and see the change.
However, when we exit the editor and come back to IRB, the edited file is not loaded automatically. This provides virtually similar experience to open the editor separately, and we can improve this experience by loading the file after edit.

As a reference, Pry's edit command supports "reload" feature that's enabled by default.
https://github.com/pry/pry/blob/master/lib/pry/commands/edit.rb

So my suggestion is to add auto-load option to edit command first with false as default. Then make that option true as default from the next major version of IRB.
When the option is true, we will simply load that file in IRB.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at IRB's implementation of the edit command and compare its behavior with Pry's referenced edit command. Trace how command options are defined and how the edited file is returned to IRB. Done means an auto-load option defaults to false initially, loads the edited file when enabled, and has a documented plan or version handling for changing the default in the next major release.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.