Commit Graph

16 Commits

Author SHA1 Message Date
Kyrylo Silin 4bb7bd2ac9 CLI: simplify Slop switch declarations
`on :foo=` is the synonym for `on :foo, :argument => true`.
2013-01-31 07:28:53 +02:00
Matthew Carey 06bff9a897 Fixed using a preprocessor just looking for --no-plugins in the ARGV array using slop. Dirty and effective fix.
Took out the trash from the dev process
2013-01-12 18:31:17 +02:00
Kyrylo Silin 2e33c98d97 Improve `-I` option support
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>
2012-08-16 03:05:34 +03:00
Greg Stearns 147379606b added exec flag chaining 2012-07-17 11:59:07 -04:00
John Mair c12f7c0e67 ensure that -f turns off local ./.pryrc loading too 2012-07-13 14:23:46 +12:00
John Mair 0af52b82ab added --disable-plugin and --select-plugin CLI options, closes #596 2012-06-26 23:45:42 +12:00
John Mair 0d1f6d5145 ensure pry doesn't load when invoked with -h option 2012-06-21 22:11:08 +12:00
John Mair 586ccfa50f unbreak pry executable
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.
2012-06-20 14:14:37 +12:00
John Mair c7bb475c61 provide CLI 'pry my_file.rb' functionality to load file through REPL loop
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.
2012-06-20 02:10:18 +12:00
Conrad Irwin 4af01cb3a5 Use a clean toplevel_binding by default. 2012-06-10 23:42:15 -07:00
Conrad Irwin 03b047e6f8 Upgrade slop syntax in cli.rb 2012-05-30 23:38:21 -07:00
John Mair 1903c19d91 fixed broken --no-plugins option 2012-01-30 14:19:10 +13:00
John Mair f4d1f448bb Ensure ARGV is not mutated during option parsing. 2012-01-29 21:46:58 +13:00
John Mair 2fdfbad039 added Pry::Hooks#dup/merge/merge! and tests 2012-01-12 16:56:41 +13:00
John Mair 6a799a7fcd updated cli.rb for new API and added tests for cli 2011-12-11 04:13:42 +13:00
John Mair 9142aa173f Added Pry::CLI class for processing command line options, with plugin support.
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
2011-12-09 03:14:33 +13:00