Pry: How to use clipit to copy a variable to the clipboard?

Created on 17 Aug 2016  路  4Comments  路  Source: pry/pry

Per the documentation at https://github.com/pry/pry/wiki/FAQ#clipit, it seems like I should be able to use clipit --var a to copy the value of a to the clipboard; however, I get an error like Error: Cannot locate: --var a!.

I did a little bit of digging and it looks like options like --var, -c, or -m have been removed, but I'm not positive. I have been able to copy a class to the clipboard by running clipit Foo instead of clipit -c Foo but I'm still not having any luck getting a variable's value into clipit, though.

Here's my pry --version output if it helps:

Pry version 0.10.3 on Ruby 2.3.0

(apologies if I'm missing anything obvious!)

Most helpful comment

Here is the work-around solution I found:

First enter the variable of interest into pry with a semi-colon to suppress it's output.
Next enter clipit -o which copies the most recent output from pry to the clipboard.

My working example:

[27] pry(main)> xml_response;
[28] pry(main)> clipit -o
Copied content to clipboard!

All 4 comments

+1 I'm having the same problem

Here is the work-around solution I found:

First enter the variable of interest into pry with a semi-colon to suppress it's output.
Next enter clipit -o which copies the most recent output from pry to the clipboard.

My working example:

[27] pry(main)> xml_response;
[28] pry(main)> clipit -o
Copied content to clipboard!

Is this still supposed to work? All I'm getting is this:

[8] pry(main)> clipit
NameError: undefined local variable or method `clipit' for main:Object
from (pry):9:in `__pry__'

Or:

[1] pry(main)> require 'gist'
=> true
[2] pry(main)> gist
NameError: undefined local variable or method `gist' for main:Object
from (pry):2:in `__pry__'

Or:

[5] pry(main)> a = :clipit!
=> :clipit!
[6] pry(main)> clipit --var a
SyntaxError: unexpected tIDENTIFIER, expecting do or '{' or '('
clipit --var a
             ^

@coisnepe I think that functionality has been moved to the pry-jist plugin

Was this page helpful?
0 / 5 - 0 ratings