1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

added exec flag chaining

This commit is contained in:
Greg Stearns 2012-07-17 11:59:07 -04:00
parent cfc5890d1c
commit 147379606b

View file

@ -73,6 +73,10 @@ class Pry
end end
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 # Bring in options defined by plugins
Pry::CLI.add_plugin_options Pry::CLI.add_plugin_options
@ -84,7 +88,9 @@ See: `https://github.com/pry` for more information.
Copyright (c) 2011 John Mair (banisterfiend) 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 on "no-pager", "Disable pager for long output" do
Pry.config.pager = false Pry.config.pager = false
@ -161,10 +167,6 @@ end.process_options do |opts|
full_name = File.expand_path(Pry::CLI.input_args.first) full_name = File.expand_path(Pry::CLI.input_args.first)
Pry.load_file_through_repl(full_name) Pry.load_file_through_repl(full_name)
exit exit
elsif opts[:exec]
exec_string = opts[:exec] + "\n"
else
exec_string = ""
end end
# Start the session (running any code passed with -e, if there is any) # Start the session (running any code passed with -e, if there is any)