From fa93b9f8166bd3abe571bee3b572bd2ff9307127 Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Fri, 13 Dec 2013 00:17:21 +0200 Subject: [PATCH] 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 # 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. --- lib/pry.rb | 2 ++ lib/pry/cli.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pry.rb b/lib/pry.rb index b283cd7d..b5cba74d 100644 --- a/lib/pry.rb +++ b/lib/pry.rb @@ -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} * " } diff --git a/lib/pry/cli.rb b/lib/pry/cli.rb index 8fcd9494..e810e3de 100644 --- a/lib/pry/cli.rb +++ b/lib/pry/cli.rb @@ -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|