ruby / ruby/irb

Display better error message if no prompt mode is given

Open
#910 0 comments 0 reactions 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

Description

aryanbeezadhur@Aryans-MacBook-Pro ~ % irb --prompt
/opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/irb/init.rb:340:in `parse_opts': undefined method `upcase' for nil (NoMethodError)

        prompt_mode = opt.upcase.tr("-", "_").intern
                         ^^^^^^^
	from /opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/irb/init.rb:48:in `setup'
	from /opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/3.3.0/irb.rb:896:in `start'
	from /opt/homebrew/Cellar/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
	from /opt/homebrew/opt/ruby/bin/irb:25:in `load'
	from /opt/homebrew/opt/ruby/bin/irb:25:in `<main>'

Instead maybe list all prompt modes?

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 in irb/init.rb at parse_opts, around the prompt_mode handling shown in the report, and reproduce the failure with irb --prompt. Replace the NoMethodError with a useful error that explains the missing prompt mode, potentially listing available modes. Done means the command reports the intended error instead of raising undefined method upcase.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.