Since the switch resembles the "noprompt" switch from IRB, it makes more
sense to keep the name the same; thus we avoid frustration of IRB
"noprompt" users.
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.
Reverts
f4d1f448bb
and passes ARGV rather than ARGV.dup to Pry::CLI.parse_options
by default.
@banister wasn't sure why that change was made in the first place, so
there's a wee bit of risk here. But all tests continue to pass,
and everything looks fine. If something does break, let's make sure
to add tests for it this time around! <3 <3 <3
Resolves https://github.com/pry/pry/issues/968, where
the '-r' argument was being passed through and throwing an error
when the file being required began with #puts
Namely, add support for multiple arguments for the `-I` option. For
example:
% pry -Ilib:../code/src
Where `:` is the delimiter for paths. In the example above `./lib` and
`../code/src` directories will be added to $LOAD_PATH array.
Also, there was a bug in Slop with respect to parsing of "fuzzy options
with arguments"[1]. It is fixed now, so the next version of Slop will
indirectly resolve our issue #674 (-r/--require doesn't behave like
irb's)[2].
And finally, wrap some very long lines in the "cli.rb" (this is just a
cosmetic change).
[1]: https://github.com/injekt/slop/issues/74
[2]: https://github.com/pry/pry/issues/674
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
Options passed to pry executable, i.e '-h' were not removed from ARGV
causing pry to attempt to open the "-h" file to load it through the REPL.
Fixed by removing flags from ARGV during option processing.
This is an interesting trick as it processes your file as if it
was user input in an interactive session. As a result, all Pry
commands are available, and they are executed non-interactively. Furthermore
the session becomes interactive when the repl loop processes a
'make-interactive' command in the file. The session also becomes
interactive when an exception is encountered, enabling you to fix
the error before returning to non-interactive processing with the
'make-non-interactive' command.
Plugins can define their own command line options by having a lib/plugin_name/cli.rb file. If this file exists
it is loaded immediately before command line options are processed. The contents of the file should be along the lines of:
Pry::CLI.add_options do
on "my-option", "My first option!" do
puts "I just defined an option!"
end
end