click-extra screenshot - Capture a command's colored output and
write it as an image or HTML.
click-extra screenshot [OPTIONS]
COMMAND_LINE...
Capture a command's colored output and write it as an image or
HTML.
Runs COMMAND_LINE with colors forced on and its terminal width
pinned, then writes the captured output where --output points. Its extension
picks the format:
- .svg: a picture of a terminal window, for a surface that strips
inline HTML. A README on GitHub or PyPI has no other option;
- .html: selectable, searchable, copy-pasteable text, for a page
you own.
Put -- before the command line so its own options are not mistaken
for this command's:
click-extra screenshot --output shot.svg -- my-cli --help
COMMAND_LINE is anything the shell can run, Click CLI or not. A
Click CLI not built on Click Extra prints its help uncolored, so --wrap
routes it through the wrap subcommand first and captures the colored
rendering.
An SVG starts each run of text on its own column, so it renders
correctly outside a web browser, where a file manager, a git client or a
thumbnailer would otherwise slide the columns out of place.
Neither format needs an optional dependency.
--record runs the command under a pseudo-terminal instead, and
writes an animated SVG of every screen it drew: the frames a spinner or a
progress bar asks a terminal for, which a plain capture never sees. The
invocation is drawn above every frame, and the loop pauses on the final
screen for as long as its line count asks, see --hold.
- COMMAND_LINE...
- --output
FILE
- Path of the file to write. Its extension picks the format: .svg for an
image, .html for selectable text, .ansi for the escape sequences
themselves. Pass - to print those to the terminal, which draws no window.
[required]
- --columns
[auto|INTEGER]
- Terminal width, in characters, the command wraps its output to and the
image is laid out at. Pass auto to pin neither: the command finds its own
width, and the image is laid out at the longest line it printed, so
nothing folds inside the picture.
- --background
[dark|light]
- Terminal chrome the capture is drawn on, and the palette its colors
resolve against. Match it to the theme the captured CLI renders with: a
light-background theme washes out on the dark default.
- --preset
[linux|macos|plain|windows]
- Terminal to draw the capture as: its window decorations, palette, font and
prompt sigil. Anything stated alongside wins over it. Left out, the
capture keeps the renderer's own neutral window.
- --border
COLOR
- Color of the frame drawn around the terminal window, as CSS names it. Pass
none to draw no frame. Defaults to the one the chrome can show.
- --border-width
PIXELS
- Thickness of that frame, in pixels.
- --radius
PIXELS
- How round the window's corners are, in pixels. Zero squares them. Defaults
to 8, or to the rounding --preset terminal draws.
- --backdrop
COLOR
- Color filling the image behind the window, margin included, as CSS names
it. Left transparent by default, so the page shows through.
- --shadow
COLOR
- Color of the drop shadow lifting the window off the page, as CSS names it.
Pass none to draw no shadow. Defaults to the one the chrome calls
for.
- --margin
PIXELS
- Transparent pixels left around the window, on all four sides. The room the
drop shadow falls into, so a capture drawing one wants some.
- --padding
PIXELS
- Pixels added inside the window, around the drawn text, on top of the few
the renderer adds on its own.
- --opacity
FLOAT RANGE
- How solid the window's body is. Under 1 it turns see-through, the way a
terminal set to transparency does: whatever the capture sits on shows
through it, while its text, frame and title bar keep their own paint.
- --watermark
TEXT
- Credit line drawn in the image's bottom-right corner, in the margin around
the window. Pass an empty string to draw none, or your own text to credit
your project instead.
- --watermark-color
COLOR
- Color that credit line is drawn in, as CSS names it, alpha included.
Defaults to a neutral gray: the line sits in the transparent margin, so it
answers to the page embedding the image rather than to the chrome.
- --head INTEGER
RANGE
- Keep only the first N lines.
- --tail INTEGER
RANGE
- Keep only the last N lines.
- --truncation
TEXT
- Line standing in for what --head or --tail cut away.
- --line-numbers
- Number the drawn lines in a gutter, the way Pygments does inline. Line 1
is the first line the picture shows.
- --emphasize-lines
LINES
- Draw a band behind the lines named, as 2,4-5. Counted from 1 as the
picture draws them. Ranges are closed: state both ends.
- --title
TEXT
- Caption drawn in an SVG's window chrome, or an HTML document's title.
- --fragment
- For HTML, emit the bare block instead of a standalone document, to paste
into a page that has its own.
- --prompt
TEXT
- Command line to display above the output, when it differs from the one
that is run. Pass an empty string to draw no prompt at all. Defaults to
the command line itself.
- --merge-stderr
- Fold the command's stderr into the capture, for a CLI printing its help
there. Off by default, which is what keeps a wrapper's build chatter out
of the image.
- --wrap
- Route COMMAND_LINE through the wrap subcommand, so a Click CLI that is not
built on Click Extra is captured with its colors. Only works on a target
wrap can resolve.
- --timeout
SECONDS
- Seconds before the command is killed. Waits forever by default. With
--record, this is also where the recording stops.
- --record
- Run the command under a pseudo-terminal and write an animated SVG of the
screens it draws, spinners and progress bars included. Needs an .svg
--output and a numeric --columns. Unix only.
- --rows INTEGER
RANGE
- With --record, the height of the terminal the command runs in, in
characters. Defaults to 24.
- --hold
[auto|FLOAT]
- With --record, extra seconds the last frame stays up before the animation
starts over, or auto to scale them to that frame's line count. Defaults to
auto.
- --blank
SECONDS
- With --record, seconds of empty screen closing the cycle. Defaults to
0.6.
- --cursor[=auto|block|bar|underline]
- Draw a terminal cursor where the command left it. Bare, it takes the shape
the --preset terminal draws; name one to override that. Omitted, no cursor
is drawn.
- --blink
SECONDS
- With --cursor, seconds one blink takes. Pass 0 to draw a steady cursor.
Defaults to 1.0.
- --closing-prompt
/ --no-closing-prompt
- Draw the shell's prompt on the row under the output, where it comes back
once the command exits. Costs no height alongside --cursor, which already
leaves that row for the cursor to wait on.
- --typing
SECONDS
- With --record, open the animation by typing the command line out, this
many seconds per character. Omitted, the prompt stands there from the
first frame.
- --submit
SECONDS
- With --typing, seconds the finished command line waits before its output
starts. Defaults to 0.4.
- --speed FLOAT
RANGE
- With --record, how much faster to play than recorded: 2 halves every
frame's time. Defaults to 1.0.
- --help /
-h
- Show this message and exit.
- --config
LOCATION
- Location of the configuration file. Supports local path with glob patterns
or remote URL.
- --no-config
- Ignore all configuration files and only use command line parameters and
environment variables.
- --validate-config
LOCATION
- Validate the configuration file and exit.
- --export-config
FORMAT
- Export the configuration in the selected format to <stdout>, then
exit.
[values: toml, yaml, json, json5, jsonc, hjson, xml, plist]
- --accessible
- Accessibility mode: disable colors and render tables in a borderless,
screen-reader-friendly format.
- --color[=auto|always|never]
- Colorize the output. A bare --color is the same as --color=always.
- --no-color
- Disable colorization (alias of --color=never).
- --progress /
--no-progress
- Show progress indicators during long operations. Disabled for
non-interactive output (pipes, dumb terminals, CI) and by
--accessible.
- --theme
[auto|dark|dracula|light|manpage|monokai|nord|solarized-dark]
- Color theme used for help screens.
- --table-format
FORMAT
- Rendering style of tables.
[values: aligned, asciidoc, colon-grid, csv, csv-excel, csv-excel-tab,
csv-unix, double-grid, double-outline, fancy-grid, fancy-outline, github,
grid, heavy-grid, heavy-outline, hjson, html, jira, json, json5, jsonc,
latex, latex-booktabs, latex-longtable, latex-raw, mediawiki, mixed-grid,
mixed-outline, moinmoin, orgtbl, outline, pipe, plain, presto, pretty,
psql, rounded-grid, rounded-outline, rst, simple, simple-grid,
simple-outline, textile, toml, tsv, unsafehtml, vertical, xml, yaml,
youtrack]
- --verbosity
LEVEL
- Either CRITICAL, ERROR, WARNING, INFO, DEBUG.
[values: CRITICAL, ERROR, WARNING, INFO, DEBUG]
- --verbose /
-v
- Increase the default WARNING verbosity by one level for each additional
repetition of the option.
- --quiet /
-q
- Decrease the default WARNING verbosity by one level for each additional
repetition of the option.
- --debug
- Shorthand for --verbosity DEBUG.
- SCREENSHOT_OUTPUT
- Path of the file to write. Its extension picks the format: .svg for an
image, .html for selectable text, .ansi for the escape sequences
themselves. Pass - to print those to the terminal, which draws no
window.
- SCREENSHOT_COLUMNS
- Terminal width, in characters, the command wraps its output to and the
image is laid out at. Pass auto to pin neither: the command finds its own
width, and the image is laid out at the longest line it printed, so
nothing folds inside the picture.
- SCREENSHOT_BACKGROUND
- Terminal chrome the capture is drawn on, and the palette its colors
resolve against. Match it to the theme the captured CLI renders with: a
light-background theme washes out on the dark default.
- SCREENSHOT_PRESET
- Terminal to draw the capture as: its window decorations, palette, font and
prompt sigil. Anything stated alongside wins over it. Left out, the
capture keeps the renderer's own neutral window.
- SCREENSHOT_BORDER
- Color of the frame drawn around the terminal window, as CSS names it. Pass
none to draw no frame. Defaults to the one the chrome can show.
- SCREENSHOT_BORDER_WIDTH
- Thickness of that frame, in pixels.
- SCREENSHOT_RADIUS
- How round the window's corners are, in pixels. Zero squares them. Defaults
to 8, or to the rounding --preset terminal draws.
- SCREENSHOT_BACKDROP
- Color filling the image behind the window, margin included, as CSS names
it. Left transparent by default, so the page shows through.
- SCREENSHOT_SHADOW
- Color of the drop shadow lifting the window off the page, as CSS names it.
Pass none to draw no shadow. Defaults to the one the chrome calls
for.
- SCREENSHOT_MARGIN
- Transparent pixels left around the window, on all four sides. The room the
drop shadow falls into, so a capture drawing one wants some.
- SCREENSHOT_PADDING
- Pixels added inside the window, around the drawn text, on top of the few
the renderer adds on its own.
- SCREENSHOT_OPACITY
- How solid the window's body is. Under 1 it turns see-through, the way a
terminal set to transparency does: whatever the capture sits on shows
through it, while its text, frame and title bar keep their own paint.
- SCREENSHOT_WATERMARK
- Credit line drawn in the image's bottom-right corner, in the margin around
the window. Pass an empty string to draw none, or your own text to credit
your project instead.
- SCREENSHOT_WATERMARK_COLOR
- Color that credit line is drawn in, as CSS names it, alpha included.
Defaults to a neutral gray: the line sits in the transparent margin, so it
answers to the page embedding the image rather than to the chrome.
- SCREENSHOT_HEAD
- Keep only the first N lines.
- SCREENSHOT_TAIL
- Keep only the last N lines.
- SCREENSHOT_TRUNCATION
- Line standing in for what --head or --tail cut away.
- SCREENSHOT_LINE_NUMBERS
- Number the drawn lines in a gutter, the way Pygments does inline. Line 1
is the first line the picture shows.
- SCREENSHOT_EMPHASIZE
- Draw a band behind the lines named, as 2,4-5. Counted from 1 as the
picture draws them. Ranges are closed: state both ends.
- SCREENSHOT_TITLE
- Caption drawn in an SVG's window chrome, or an HTML document's title.
- SCREENSHOT_FRAGMENT
- For HTML, emit the bare block instead of a standalone document, to paste
into a page that has its own.
- SCREENSHOT_PROMPT
- Command line to display above the output, when it differs from the one
that is run. Pass an empty string to draw no prompt at all. Defaults to
the command line itself.
- SCREENSHOT_MERGE_STDERR
- Fold the command's stderr into the capture, for a CLI printing its help
there. Off by default, which is what keeps a wrapper's build chatter out
of the image.
- SCREENSHOT_WRAP
- Route COMMAND_LINE through the wrap subcommand, so a Click CLI that is not
built on Click Extra is captured with its colors. Only works on a target
wrap can resolve.
- SCREENSHOT_TIMEOUT
- Seconds before the command is killed. Waits forever by default. With
--record, this is also where the recording stops.
- SCREENSHOT_RECORD
- Run the command under a pseudo-terminal and write an animated SVG of the
screens it draws, spinners and progress bars included. Needs an .svg
--output and a numeric --columns. Unix only.
- SCREENSHOT_ROWS
- With --record, the height of the terminal the command runs in, in
characters. Defaults to 24.
- SCREENSHOT_HOLD
- With --record, extra seconds the last frame stays up before the animation
starts over, or auto to scale them to that frame's line count. Defaults to
auto.
- SCREENSHOT_BLANK
- With --record, seconds of empty screen closing the cycle. Defaults to
0.6.
- SCREENSHOT_CURSOR
- Draw a terminal cursor where the command left it. Bare, it takes the shape
the --preset terminal draws; name one to override that. Omitted, no cursor
is drawn.
- SCREENSHOT_BLINK
- With --cursor, seconds one blink takes. Pass 0 to draw a steady cursor.
Defaults to 1.0.
- SCREENSHOT_CLOSING_PROMPT
- Draw the shell's prompt on the row under the output, where it comes back
once the command exits. Costs no height alongside --cursor, which already
leaves that row for the cursor to wait on.
- SCREENSHOT_TYPING
- With --record, open the animation by typing the command line out, this
many seconds per character. Omitted, the prompt stands there from the
first frame.
- SCREENSHOT_SUBMIT
- With --typing, seconds the finished command line waits before its output
starts. Defaults to 0.4.
- SCREENSHOT_SPEED
- With --record, how much faster to play than recorded: 2 halves every
frame's time. Defaults to 1.0.
- SCREENSHOT__CLICK_DEFAULT_HELP
- Show this message and exit.
- SCREENSHOT_CONFIG
- Location of the configuration file. Supports local path with glob patterns
or remote URL.
- SCREENSHOT_VALIDATE_CONFIG
- Validate the configuration file and exit.
- SCREENSHOT_EXPORT_CONFIG
- Export the configuration in the selected format to <stdout>, then
exit.
- SCREENSHOT_ACCESSIBLE
- Accessibility mode: disable colors and render tables in a borderless,
screen-reader-friendly format.
- SCREENSHOT_COLOR
- Colorize the output. A bare --color is the same as --color=always.
- SCREENSHOT_NO_COLOR
- Disable colorization (alias of --color=never).
- SCREENSHOT_PROGRESS
- Show progress indicators during long operations. Disabled for
non-interactive output (pipes, dumb terminals, CI) and by
--accessible.
- SCREENSHOT_THEME
- Color theme used for help screens.
- SCREENSHOT_TABLE_FORMAT
- Rendering style of tables.
- SCREENSHOT_VERBOSITY
- Either CRITICAL, ERROR, WARNING, INFO, DEBUG.
- SCREENSHOT_VERBOSE
- Increase the default WARNING verbosity by one level for each additional
repetition of the option.
- SCREENSHOT_QUIET
- Decrease the default WARNING verbosity by one level for each additional
repetition of the option.
- SCREENSHOT_DEBUG
- Shorthand for --verbosity DEBUG.
- SCREENSHOT_TIME
- Measure and print elapsed execution time.
- SCREENSHOT_PARAMS
- Show all CLI parameters, their provenance, defaults and value, then
exit.
- SCREENSHOT_TREE
- Show the tree of nested subcommands and exit.
- SCREENSHOT_MAN
- Read the command's manual page and exit.
- SCREENSHOT_HELP_FORMAT
- Render the command in the given format and exit.
- SCREENSHOT_VERSION
- Show the version and exit.
~/.config/click-extra/{*.toml,*.yaml,*.yml,*.json,*.json5,*.jwcc,*.jsonc,*.hjson,*.ini,*.xml,*.plist,*.sqlite,*.sqlite3,*.conf,pyproject.toml}
- 0
- Success.
- 1
- A runtime error, or an aborted prompt (Ctrl-C, a declined
confirmation).
- 2
- A usage error: unknown option, invalid value, missing operand, or an
unparsable configuration file.