Skip to content

Commit

Permalink
chafa: Reformat and section the help text
Browse files Browse the repository at this point in the history
  • Loading branch information
hpjansson committed Sep 20, 2023
1 parent 153d8cc commit d350f56
Showing 1 changed file with 90 additions and 77 deletions.
167 changes: 90 additions & 77 deletions tools/chafa/chafa.c
Expand Up @@ -419,124 +419,137 @@ static void
print_summary (void)
{
const gchar *summary =
" Chafa (Character Art Facsimile) terminal graphics and character art generator.\n\n"
" Chafa (Character Art Facsimile) terminal graphics and character art generator.\n"

"Options:\n"
"\nGeneral options:\n"

" -h, --help Show help.\n"
" --version Show version.\n"
" -v, --verbose Be verbose.\n\n"
" -v, --verbose Be verbose.\n"

"\nOutput encoding:\n"

" --animate=BOOL Whether to allow animation [on, off]. Defaults to on.\n"
" When off, will show a still frame from each animation.\n"
" --bg=COLOR Background color of display (color name or hex).\n"
" -C, --center=BOOL Center images horizontally in the view [on, off]. Defaults\n"
" to off.\n"
" --clear Clear screen before processing each file.\n"
" -c, --colors=MODE Set output color mode; one of [none, 2, 8, 16/8, 16, 240,\n"
" 256, full]. Defaults to best guess.\n"
" --color-extractor=EXTR Method for extracting color from an area\n"
" [average, median]. Average is the default.\n"
" --color-space=CS Color space used for quantization; one of [rgb, din99d].\n"
" Defaults to rgb, which is faster but less accurate.\n"
" --dither=DITHER Set output dither mode; one of [none, ordered,\n"
" diffusion]. No effect with 24-bit color. Defaults to none.\n"
" --dither-grain=WxH Set dimensions of dither grains in 1/8ths of a\n"
" character cell [1, 2, 4, 8]. Defaults to 4x4.\n"
" --dither-intensity=NUM Multiplier for dither intensity [0.0 - inf].\n"
" Defaults to 1.0.\n"
" -d, --duration=SECONDS The time to show each file. If showing a single file,\n"
" defaults to zero for a still image and infinite for an\n"
" animation. For multiple files, defaults to zero. Animations\n"
" will always be played through at least once.\n"
" --fg=COLOR Foreground color of display (color name or hex).\n"
" --fg-only Leave the background color untouched. This produces\n"
" character-cell output using foreground colors only.\n"
" --fill=SYMS Specify character symbols to use for fill/gradients.\n"
" Defaults to none. See below for full usage.\n"
" --fit-width Fit images to the view's width, potentially exceeding its\n"
" height.\n"
" --font-ratio=W/H Target font's width/height ratio. Can be specified as\n"
" a real number or a fraction. Defaults to 1/2.\n"
" -f, --format=FORMAT Set output format; one of [iterm, kitty, sixels,\n"
" symbols]. Iterm, kitty and sixels yield much higher\n"
" quality but enjoy limited support. Symbols mode yields\n"
" beautiful character art.\n"
" --glyph-file=FILE Load glyph information from FILE, which can be any\n"
" font file supported by FreeType (TTF, PCF, etc).\n"
" --invert Invert video. For display with bright backgrounds in\n"
" color modes 2 and none. Swaps --fg and --bg.\n"
" --margin-bottom=NUM When terminal size is detected, reserve at least NUM\n"
" rows at the bottom as a safety margin. Can be used to\n"
" prevent images from scrolling out. Defaults to 1.\n"
" --margin-right=NUM When terminal size is detected, reserve at least NUM\n"
" columns on the right-hand side as a safety margin. Defaults\n"
" to 0.\n"
" -O, --optimize=NUM Compress the output by using control sequences\n"
" intelligently [0-9]. 0 disables, 9 enables every\n"
" available optimization. Defaults to 5, except for when\n"
" used with \"-c none\", where it defaults to 0.\n"
" --relative=BOOL Use relative cursor positioning [on, off]. When on,\n"
" control sequences will be used to position images relative\n"
" to the cursor. When off, newlines will be used to separate\n"
" rows instead for e.g. 'less -R' interop. Defaults to off.\n"
" --passthrough=MODE Graphics protocol passthrough [auto, none, screen,\n"
" tmux]. Used to show pixel graphics through multiplexers.\n"
" --polite=BOOL Polite mode [on, off]. Defaults to on. Turning this off\n"
" may enhance presentation and prevent interference from\n"
" other programs, but risks leaving the terminal in an\n"
" altered state (rude).\n"
" -p, --preprocess=BOOL Image preprocessing [on, off]. Defaults to on with 16\n"
" colors or lower, off otherwise.\n"
" --relative=BOOL Use relative cursor positioning [on, off]. When on,\n"
" control sequences will be used to position images relative\n"
" to the cursor. When off, newlines will be used to separate\n"
" rows instead for e.g. 'less -R' interop. Defaults to off.\n"

"\nSize and layout:\n"

" -C, --center=BOOL Center images horizontally in the view [on, off]. Defaults\n"
" to off.\n"
" --clear Clear screen before processing each file.\n"
" --fit-width Fit images to the view's width, potentially exceeding its\n"
" height.\n"
" --font-ratio=W/H Target font's width/height ratio. Can be specified as\n"
" a real number or a fraction. Defaults to 1/2.\n"
" --margin-bottom=NUM When terminal size is detected, reserve at least NUM\n"
" rows at the bottom as a safety margin. Can be used to\n"
" prevent images from scrolling out. Defaults to 1.\n"
" --margin-right=NUM When terminal size is detected, reserve at least NUM\n"
" columns on the right-hand side as a safety margin. Defaults\n"
" to 0.\n"
" --scale=NUM Scale image, respecting terminal's maximum dimensions. 1.0\n"
" approximates original pixel dimensions. Specify \"max\" to\n"
" use all available space. Defaults to 1.0 for pixel graphics\n"
" and 4.0 for symbols.\n"
" -s, --size=WxH Set maximum image dimensions in columns and rows. By\n"
" default this will be equal to the view size.\n"
" --speed=SPEED Set the speed animations will play at. This can be\n"
" either a unitless multiplier, or a real number followed\n"
" by \"fps\" to apply a specific framerate.\n"
" --stretch Stretch image to fit output dimensions; ignore aspect.\n"
" Implies --scale max.\n"
" --symbols=SYMS Specify character symbols to employ in final output.\n"
" See below for full usage and a list of symbol classes.\n"
" --threads=NUM Maximum number of CPU threads to use. If left unspecified\n"
" or negative, this will equal available CPU cores.\n"
" -t, --threshold=NUM Threshold above which full transparency will be used\n"
" [0.0 - 1.0].\n"
" --view-size=WxH Set the view size in columns and rows. By default this\n"
" will be the size of your terminal, or 80x25 if size\n"
" detection fails. If one dimension is omitted, it will\n"
" be set to a reasonable approximation of infinity.\n"

"\nAnimation and timing:\n"

" --animate=BOOL Whether to allow animation [on, off]. Defaults to on.\n"
" When off, will show a still frame from each animation.\n"
" -d, --duration=SECONDS The time to show each file. If showing a single file,\n"
" defaults to zero for a still image and infinite for an\n"
" animation. For multiple files, defaults to zero. Animations\n"
" will always be played through at least once.\n"
" --speed=SPEED Set the speed animations will play at. This can be\n"
" either a unitless multiplier, or a real number followed\n"
" by \"fps\" to apply a specific framerate.\n"
" --watch Watch a single input file, redisplaying it whenever its\n"
" contents change. Will run until manually interrupted\n"
" or, if --duration is set, until it expires.\n"

"\nColors and processing:\n"

" --bg=COLOR Background color of display (color name or hex).\n"
" -c, --colors=MODE Set output color mode; one of [none, 2, 8, 16/8, 16, 240,\n"
" 256, full]. Defaults to best guess.\n"
" --color-extractor=EXTR Method for extracting color from an area\n"
" [average, median]. Average is the default.\n"
" --color-space=CS Color space used for quantization; one of [rgb, din99d].\n"
" Defaults to rgb, which is faster but less accurate.\n"
" --dither=DITHER Set output dither mode; one of [none, ordered,\n"
" diffusion]. No effect with 24-bit color. Defaults to none.\n"
" --dither-grain=WxH Set dimensions of dither grains in 1/8ths of a\n"
" character cell [1, 2, 4, 8]. Defaults to 4x4.\n"
" --dither-intensity=NUM Multiplier for dither intensity [0.0 - inf].\n"
" Defaults to 1.0.\n"
" --fg=COLOR Foreground color of display (color name or hex).\n"
" --invert Invert video. For display with bright backgrounds in\n"
" color modes 2 and none. Swaps --fg and --bg.\n"
" -p, --preprocess=BOOL Image preprocessing [on, off]. Defaults to on with 16\n"
" colors or lower, off otherwise.\n"
" -t, --threshold=NUM Threshold above which full transparency will be used\n"
" [0.0 - 1.0].\n"

"\nResource allocation:\n"

" --threads=NUM Maximum number of CPU threads to use. If left unspecified\n"
" or negative, this will equal available CPU cores.\n"
" -w, --work=NUM How hard to work in terms of CPU and memory [1-9]. 1 is the\n"
" cheapest, 9 is the most accurate. Defaults to 5.\n\n"
" cheapest, 9 is the most accurate. Defaults to 5.\n"

"\nExtra options for symbol encoding:\n"

" --fg-only Leave the background color untouched. This produces\n"
" character-cell output using foreground colors only.\n"
" --fill=SYMS Specify character symbols to use for fill/gradients.\n"
" Defaults to none. See below for full usage.\n"
" --glyph-file=FILE Load glyph information from FILE, which can be any\n"
" font file supported by FreeType (TTF, PCF, etc).\n"
" --symbols=SYMS Specify character symbols to employ in final output.\n"
" See below for full usage and a list of symbol classes.\n"

"\nAccepted classes for --symbols and --fill:\n"

" Accepted classes for --symbols and --fill are [all, none, space, solid,\n"
" stipple, block, border, diagonal, dot, quad, half, hhalf, vhalf, inverted,\n"
" braille, technical, geometric, ascii, legacy, sextant, wedge, wide, narrow,\n"
" extra]. Some symbols belong to multiple classes, e.g. diagonals are also\n"
" borders. You can specify a list of classes separated by commas, or prefix them\n"
" with + and - to add or remove symbols relative to the existing set. The\n"
" ordering is significant; see the man page for more.\n\n"
" all ascii braille extra imported narrow solid ugly\n"
" alnum bad diagonal geometric inverted none space vhalf\n"
" alpha block digit half latin quad stipple wedge\n"
" ambiguous border dot hhalf legacy sextant technical wide\n"

" The default symbol set is block+border+space-wide-inverted for all modes\n"
" except \"none\", which uses block+border+space-wide (including inverse symbols).\n\n"
"\n These can be combined with + and -, e.g. block+border-diagonal or all-wide.\n"

"Examples:\n"
"\nExamples:\n"

" Generate 16-color output with perceptual color picking and avoid using\n"
" dot and stipple symbols:\n\n"
" $ chafa -c 16 --color-space din99d --symbols -dot-stipple in.jpg\n\n"
" $ chafa --scale max in.jpg # As big as will fit\n"
" $ chafa --clear -C on -d 5 *.gif # A well-paced slideshow\n"
" $ chafa -f symbols --symbols ascii -c none in.png # Old-school ASCII art\n\n"

" Generate uncolored output using block and border symbols, but avoid the\n"
" solid block symbol:\n\n"
" $ chafa -c none --symbols block+border-solid in.png\n";
"If your OS comes with manual pages, you can type 'man chafa' for more.\n";

g_print ("Usage:\n %s [OPTION...] [FILE...]\n\n%s\n",
g_print ("Usage:\n %s [OPTION...] [FILE...]\n\n%s",
options.executable_name,
summary);
}
Expand Down

0 comments on commit d350f56

Please sign in to comment.