Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Update documentation about the new copy command #1067

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ Debugging
Misc
edit Open a file or source location.
measure `measure` enables the mode to measure processing time. `measure :off` disables it.
copy Copy expression output to clipboard

Context
show_doc Look up documentation with RI.
Expand Down
16 changes: 13 additions & 3 deletions lib/irb/command/copy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@
module IRB
module Command
class Copy < Base
category "Workspace"
description "Copy command output to clipboard"
category "Misc"
description "Copy expression output to clipboard"

help_message(<<~HELP)
Usage: copy [command]
Usage: copy ([expression])

When given:
- an expression, copy the inspect result of the expression to the clipboard.
- no arguments, copy the last evaluated result (`_`) to the clipboard.

Examples:

copy Foo.new
copy User.all.to_a
copy
HELP

def execute(arg)
Expand Down
Loading