mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-16 21:45:03 +02:00
Document the additions to the clipboard kitten
This commit is contained in:
@@ -255,6 +255,8 @@ if you specify a program-to-run you can use the special placeholder
|
||||
p('.. program::', 'kitty @', func.name)
|
||||
p('\n\n' + as_rst(*cli_params_for(func)))
|
||||
from kittens.runner import get_kitten_cli_docs
|
||||
from kitty.fast_data_types import wrapped_kitten_names
|
||||
|
||||
for kitten in all_kitten_names:
|
||||
data = get_kitten_cli_docs(kitten)
|
||||
if data:
|
||||
@@ -263,7 +265,11 @@ if you specify a program-to-run you can use the special placeholder
|
||||
p('.. program::', 'kitty +kitten', kitten)
|
||||
p('\nSource code for', kitten)
|
||||
p('-' * 72)
|
||||
p(f'\nThe source code for this kitten is `available on GitHub <https://github.com/kovidgoyal/kitty/tree/master/kittens/{kitten}>`_.')
|
||||
if kitten in wrapped_kitten_names():
|
||||
scurl = f'https://github.com/kovidgoyal/kitty/tree/master/tools/cmd/{kitten}'
|
||||
else:
|
||||
scurl = f'https://github.com/kovidgoyal/kitty/tree/master/kittens/{kitten}'
|
||||
p(f'\nThe source code for this kitten is `available on GitHub <{scurl}>`_.')
|
||||
p('\nCommand Line Interface')
|
||||
p('-' * 72)
|
||||
p('\n\n' + option_spec_as_rst(
|
||||
|
||||
@@ -11,14 +11,40 @@ from the shell. It even works over SSH. Using it is as simple as::
|
||||
|
||||
echo hooray | kitty +kitten clipboard
|
||||
|
||||
All text received on :file:`stdin` is copied to the clipboard.
|
||||
All text received on :file:`STDIN` is copied to the clipboard.
|
||||
|
||||
To get text from the clipboard you have to enable reading of the clipboard
|
||||
in :opt:`clipboard_control` in :file:`kitty.conf`. Once you do that, you can
|
||||
use::
|
||||
To get text from the clipboard::
|
||||
|
||||
kitty +kitten clipboard --get-clipboard
|
||||
|
||||
The text will be written to :file:`STDOUT`. Note that by default kitty asks for
|
||||
permission when a program attempts to read the clipboard. This can be
|
||||
controlled via :opt:`clipboard_control`.
|
||||
|
||||
.. versionadded:: 0.27.0
|
||||
Support for copying arbitrary data types
|
||||
|
||||
The clipboard kitten can be used to send/receive
|
||||
more than just plain text from the system clipboard. You can transfer arbitrary
|
||||
data types. Best illustrated with some examples::
|
||||
|
||||
# Copy an image to the clipboard:
|
||||
kitty +kitten clipboard picture.png
|
||||
|
||||
# Copy an image and some text to the clipboard:
|
||||
kitty +kitten clipboard picture.jpg text.txt
|
||||
|
||||
# Copy text from STDIN and an image to the clipboard:
|
||||
echo hello | kitty +kitten clipboard picture.png /dev/stdin
|
||||
|
||||
# Copy any raster image available on the clipboard to a PNG file:
|
||||
kitty +kitten clipboard -g picture.png
|
||||
|
||||
# Copy an image to a file and text to STDOUT:
|
||||
kitty +kitten clipboard -g picture.png /dev/stdout
|
||||
|
||||
Normally, the kitten guesses MIME types based on the file names. To control the
|
||||
MIME types precisely, use the :option:`--mime <kitty +kitten clipboard --mime>` option.
|
||||
|
||||
.. program:: kitty +kitten clipboard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user