Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added exec flag chaining

  • Loading branch information...
commit 147379606b088dc6aba771f4a3c472bc33159754 1 parent cfc5890
Greg Stearns grstearns authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/pry/cli.rb
12 lib/pry/cli.rb
View
@@ -73,6 +73,10 @@ def parse_options(args=ARGV.dup)
end
end
+
+# String that is built to be executed on start (created by -e and -exec switches)
+exec_string = ""
+
# Bring in options defined by plugins
Pry::CLI.add_plugin_options
@@ -84,7 +88,9 @@ def parse_options(args=ARGV.dup)
Copyright (c) 2011 John Mair (banisterfiend)
--
}
- on :e, :exec, "A line of code to execute in context before the session starts", :argument => true
+ on :e, :exec, "A line of code to execute in context before the session starts", :argument => true do |input|
+ exec_string << input + "\n"
+ end
on "no-pager", "Disable pager for long output" do
Pry.config.pager = false
@@ -161,10 +167,6 @@ def parse_options(args=ARGV.dup)
full_name = File.expand_path(Pry::CLI.input_args.first)
Pry.load_file_through_repl(full_name)
exit
- elsif opts[:exec]
- exec_string = opts[:exec] + "\n"
- else
- exec_string = ""
end
# Start the session (running any code passed with -e, if there is any)
Please sign in to comment.
Something went wrong with that request. Please try again.