Skip to content

Commit

Permalink
Update documentation about the new copy command (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored Jan 21, 2025
1 parent 03c3658 commit 6194111
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
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

0 comments on commit 6194111

Please sign in to comment.