diff --git a/doc/Index.md b/doc/Index.md index bc1461eff..20a86e2d9 100644 --- a/doc/Index.md +++ b/doc/Index.md @@ -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. diff --git a/lib/irb/command/copy.rb b/lib/irb/command/copy.rb index b6aee0c33..93410b878 100644 --- a/lib/irb/command/copy.rb +++ b/lib/irb/command/copy.rb @@ -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)