using the pry plugin : pry-clipboard
When I go to type 'copy-history' to copy the last line of my history, it literally is copying 'copy-history' and pasting 'copy-history'.
Am I missing something here? Even when I feed it a range option its copying things that aren't even in my history...
[19] pry(RSpec::ExampleGroups::MyHelperModuleWorks)> copy-history
-*-*- Copy history to clipboard -*-*-
copy-history
[20] pry(RSpec::ExampleGroups::MyHelperModuleWorks)>
~~~~
[5] pry(RSpec::ExampleGroups::MyHelperModuleWorks)> history
1: puts "this is what I want to copy"
2: puts "this also should get copied"
3: puts "and this..."
4: puts "but we don't want this"
[6] pry(RSpec::ExampleGroups::MyHelperModuleWorks)> copy-history --range 1..3
NoMethodError: undefined method `<' for true:TrueClass
from /Users/MY_USR_NAME/.rvm/rubies/ruby-2.1.3/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/code/code_range.rb:50:in `find_start_index'
[6] pry(RSpec::ExampleGroups::MyHelperModuleWorks)>
I had same problem
[19] pry(RSpec::ExampleGroups::MyHelperModuleWorks)> copy-history
-*-*- Copy history to clipboard -*-*-
copy-history
[20] pry(RSpec::ExampleGroups::MyHelperModuleWorks)>
changing one line worked for me.
diff --git a/lib/pry-clipboard.rb b/lib/pry-clipboard.rb
index 146a003..2c643be 100644
--- a/lib/pry-clipboard.rb
+++ b/lib/pry-clipboard.rb
@@ -50,6 +50,7 @@ module PryClipboard
end
def process
+ #binding.pry
history = Pry::Code(Pry.history.to_a)
history = if num_arg
@@ -66,7 +67,7 @@ module PryClipboard
n = history.lines.count if n > history.lines.count
history.take_lines(-n, n)
else
- history.take_lines(-1, 1)
+ history.take_lines(-2, 1)
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With