Command reference
ed clipboard inspect
Lists the representations of one entry, or previews one of them.
ed clipboard inspect <index> [--type <type>] [--bytes] [--json]| Name | Type / values | Default | What it does |
|---|---|---|---|
<index> |
integer, from 1 | required | The entry number, counting from 1. |
--type |
type identifier or number | none | Preview one representation by type identifier or by its number. |
--bytes |
flag | off | Show the first bytes as hex instead of the decoded preview. |
--json |
flag | off | Emit JSON on stdout. |
An app that copies usually offers several representations of the same content,
such as public.utf8-plain-text, public.html and public.rtf. Clipboard
history saves one of them per entry. While an entry is still what is on the
pasteboard, inspect lists every type of the first pasteboard item, at most 24,
by name only. Nothing is read until you preview or copy one, so apps that
provide data lazily never render types you do not ask for. Once anything else
is copied, the entry offers only its saved copy.
$ ed clipboard inspect 1# TYPE NAME SIZE SOURCE1 public.utf8-plain-text Plain text On the pasteboard2 public.html HTML On the pasteboardSIZE is known for the saved copy and empty for types that have not been read.
With --json the list is an object:
{ "id": "7F1C2B9A-4D3E-4A5B-9C8D-1E2F3A4B5C6D", "index": 1, "items": 1, "live": true, "representations": [ { "name": "Plain text", "number": 1, "origin": "pasteboard", "sizeBytes": null, "type": "public.utf8-plain-text" } ]}live is true while the entry is the current pasteboard. origin is
pasteboard or saved. items is how many items were on the pasteboard; only
the first is listed.
--type public.html reads that one representation and prints the decoded
preview: text as text, HTML as its source, rich text without formatting, a
binary property list as XML, and an image as its name, pixel size and file
size. Data that is not text, and malformed data, prints as a hex dump of the
first 4 KB, with a note on stderr explaining why. --bytes always prints the
hex dump. With --json the preview object adds format (text, image or
bytes), text, bytes, imageBytes, truncated, notice and detail.
If the pasteboard changes between the list and the preview, the preview fails and asks you to inspect again rather than showing a different clip.
To copy one representation, use ed clipboard copy with
--type.
| Code | When |
|---|---|
| 0 | The list or preview was printed |
| 1 | The pasteboard changed, or the app no longer provides that type |
| 3 | No entry with that number, or no representation with that type or number |
| 4 | The history is empty |
Where to go next
ed clipboard, the rest of this group- All
edcommands