mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
lib/pry.rb,lib/pry/cli.rb: fix the "no-prompt" switch
This sets two prompts for Pry. The issue is that if you have a custom prompt (like me), then you'll face this error: undefined method `[]=' for #<Proc:0x00000002f329e0> The problem is that the no-prompt switch doesn't set the second prompt. Also, be consistent with the codebase and store the prompt in a constant.
This commit is contained in:
parent
f435bde464
commit
fa93b9f816
2 changed files with 3 additions and 1 deletions
|
@ -70,6 +70,8 @@ class Pry
|
|||
# A simple prompt - doesn't display target or nesting level
|
||||
SIMPLE_PROMPT = [proc { ">> " }, proc { " | " }]
|
||||
|
||||
NO_PROMPT = [proc { '' }, proc { '' }]
|
||||
|
||||
SHELL_PROMPT = [
|
||||
proc { |target_self, _, _| "#{Pry.config.prompt_name} #{Pry.view_clip(target_self)}:#{Dir.pwd} $ " },
|
||||
proc { |target_self, _, _| "#{Pry.config.prompt_name} #{Pry.view_clip(target_self)}:#{Dir.pwd} * " }
|
||||
|
|
|
@ -167,7 +167,7 @@ Copyright (c) 2013 John Mair (banisterfiend)
|
|||
end
|
||||
|
||||
on "no-prompt", "No prompt mode" do
|
||||
Pry.config.prompt = proc { '' }
|
||||
Pry.config.prompt = Pry::NO_PROMPT
|
||||
end
|
||||
|
||||
on :r, :require=, "`require` a Ruby script at startup" do |file|
|
||||
|
|
Loading…
Reference in a new issue