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

36 commits

Author SHA1 Message Date
Jonathan Soeder
483493e340 Adds ability to customize the display name on the prompt 2012-08-22 14:12:31 -05:00
☈king
6617856b06 Add Bond completion (when available) cirwin++ 2012-08-18 22:49:20 +00:00
John Mair
be95f6a3eb added option to turn off local .pryrc loading, closes #612 2012-07-04 15:10:10 +12:00
misfo
cd8ca7b82b Allow Pry.config.editor procs that take a reloading arg
This allow the user to implement an editor proc that only blocks the Pry
process if Pry is going to reload code when it returns:

    Pry.config.editor = proc do |file, line, reloading|
      "subl #{'--wait' if reloading} #{file}:#{line}"
    end
2012-04-03 21:48:09 -05:00
misfo
f78ed73443 Documentation and error message updates for editing 2012-04-03 21:45:46 -05:00
John Mair
578c7d3ebf improved Pry.config docs, closes #499 2012-04-02 22:51:40 +12:00
John Mair
e5bef51789 added Pry.config.extra_sticky_locals config option
* Pry.config.extra_sticky_locals[:random] = proc { rand(10) }
* alternatively, Pry.start binding, :extra_sticky_locals => { :random => proc { rand(10) } }
* updated tests
2012-03-14 15:35:24 +13:00
John Mair
1ba42f49ea removed unnecessary config plugins.enabled option 2012-01-30 14:38:53 +13:00
John Mair
3a4041cb24 Allow use of hash-based hooks, but show warning.
* Shows a deprecation warning when used with a link to the new `Pry::Hooks` documentation.
* When hash-based hooks are used they create anonymous hooks for the associated event.
i.e Pry.hooks = { :before_session => proc { puts 'hi' } }, the 'name' of that hook is `nil`.
* Anonymous hooks (nil-named) are different to ordinary hooks in that they dont raise an exception when user attempts to define another of the same name, they just silently overwrite previous one. This is to
mimic the old hash-based behaviour.
* Pry::Hooks[] and Pry::Hooks[]= are defined too, and they get and set the anonymous hook for the given event, i.e hooks[:before_session] = proc { "hi" } is equivalent to: hook.add_hook(:before_session, nil,
proc { "hi" })
* Proc::Hook#[] and Pry::Hooks#[]= also display deprecation warnings.
2012-01-24 21:44:21 +13:00
John Mair
7671aa6684 Wrapped config.hooks{=} to error on old API.
We no longer wish to support the (undocumented!!) hash-based hooks API. When a user attempts to use this API
Pry will raise a `Pry::ObsoleteError` exception with a message telling them to use `Pry::Hooks` instead.
2012-01-24 01:41:03 +13:00
Ryan Fitzgerald
000f245ef3 allow cat to center output on a line number (e.g., "cat lib/pry.rb:30") 2012-01-14 22:30:32 -08:00
John Mair
9eea662733 Added Pry.config.gist.inspecter config option.
Useful for determining how expression output will be gisted.
Also fixed some typos in config.rb for Pry.config.history docs
2011-12-11 21:19:27 +13:00
Conrad Irwin
2ac92f17a1 Fix a typo 2011-11-24 23:20:06 -08:00
Conrad Irwin
76336c5780 Trap SIGINT on jruby by default 2011-11-22 09:07:31 -08:00
John Mair
6e92cff1f7 Display a warning when command name collides with a local/method.
Warnings can be turned on/off by setting Pry.config.collision_warning = true/false. Defaults to true
2011-11-17 16:00:46 +13:00
Ryan Fitzgerald
98a063019a add correct_indent option 2011-10-27 23:57:11 -07:00
Conrad Irwin
31a171628a Pre-declare config.exception_window_size 2011-10-16 18:18:08 -07:00
John Mair
8ca04c22df fixed some style issues; renamed Pry.config.indent to Pry.config.auto_indent 2011-10-09 00:40:55 +13:00
Yorick Peterse
e9c2f383eb Pry now indents code similar to IRB.
Code is indented using the class Pry::Indent. This class uses an internal stack
that contains the indentation levels for each line of code. Certain keywords
such as "class" or "def" will add data to this stack so that the next line is
indented, other keywords such as "end" or "}" will remove data from the stack,
causing the next line to be un-indented.

Pry::Indent is hooked into Pry#retrieve_line as well as Pry#readline. This means
that both input strings as well as the ones displayed by "show-method" are
indented. Sadly due to the way Readline works input strings are indented similar
to IRB. This means that instead of the following:

    > class User
    >   def initialize
    >   end
    > end

You'll get the following:

    > class User
    >   def initialize
    >     end
    >   end

While annoying there doesn't seem to be a way to work around this issue. Luckily
the "show-method" command indents your code properly.

By default indentation is turned on. This can be turned off (or back on) using
the configuration item Pry.config.indent. However, if you turn this option off
after a method is defined "show-method" will still show it with indentation as
indentation happens on input rather than only when code is displayed.

For more information see Pry::Indent#indent in lib/pry/indent.rb.

Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>
2011-10-05 19:04:44 +02:00
Conrad Irwin
aaf0cac06b Add a global exception whitelist (Issue 235) 2011-09-19 10:37:50 +08:00
John Mair
8f6878e0e3 now passing output object and pry instance into Pry.config.system proc 2011-09-18 00:42:29 +12:00
John Mair
66c464bafe system is now determined by a proc, Pry.config.system 2011-09-17 18:35:17 +12:00
John Mair
5a274b26df added input_stack support to Pry
input_stack allows Pry instances to seemlessly continue reading input from other input objects on the stack when the current object generates EOF
Useful when you need to temporarily divert reading to another object and then switch back to another object
2011-09-15 21:10:37 +12:00
John Mair
7509f6b6c1 Pry.editor -> Pry.config.editor 2011-08-30 03:00:13 +12:00
John Mair
3e137e8b1b added Pry.config.control_d_handler and also changed way control d (^D) works inside multi-line expressions (it clears input buffer) 2011-08-30 02:22:58 +12:00
John Mair
b8847e538b removed unused results_pager config option 2011-07-27 05:16:07 +12:00
Ryan Fitzgerald
7ece261723 implement command_prefix feature 2011-07-26 00:34:54 -07:00
Ryan Fitzgerald
3b955809ca add config to disable auto-reload 2011-07-24 23:11:57 -07:00
Ryan Fitzgerald
c8845bffb4 defer loading of requires specified on the command line 2011-07-24 20:13:18 -07:00
John Mair
3c7a1c2eca save before computer crash 2011-06-11 22:44:30 +12:00
David Palm
34f85aa3a9 Changing Pry.config.history.load/save into should_load/should_save to work aroung ActiveSupport 3.1.rc2 hijacking "load"
Changing test_pry.rb to require 'helper' using absolute path, so we can run tests under 1.9.2+
2011-06-09 12:25:06 +02:00
Mon ouïe
b96f00cebd Allowed size of history arrays to be set in Pry.config 2011-06-05 18:37:54 +02:00
John Mair
94a1f993e6 Replaced Pry.config.should_load_plugins with Pry.config.plugins.enabled. Also added Pry.config.plugins.strict_loading config option; also updated test helper to reflect changes 2011-06-02 21:41:56 +12:00
John Mair
7bc03759d9 defining history config option directly in Config class and documenting it 2011-05-30 03:47:48 +12:00
John Mair
e1d9763c28 Implemented readline history saving (~/.pry_history file by default) along with a bunch of options on Pry.config.history . Migrating more options over to Pry.config object. 2011-05-29 00:01:15 +12:00
John Mair
e6c05a32d3 added config.rb to repo 2011-05-28 20:43:32 +12:00