Skip to content

Commit 971251c

Browse files
desertstsunghpjansson
authored andcommitted
Draft a full zsh completion
1 parent 118d255 commit 971251c

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

docs/chafa.xml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ fraction. Defaults to 1/2. This will only be applied in symbol mode.
217217
</varlistentry>
218218

219219
<varlistentry>
220-
<term><option>-g, --grid <replaceable>cols</replaceable>x<replaceable>rows</replaceable></option></term>
220+
<term><option>--grid <replaceable>cols</replaceable>x<replaceable>rows</replaceable></option></term>
221221
<listitem><para>
222222
Lay out images in a grid of <replaceable>cols</replaceable> columns and
223223
<replaceable>rows</replaceable> rows per screenful. Either
@@ -229,13 +229,27 @@ picked automatically.
229229
</varlistentry>
230230

231231
<varlistentry>
232-
<term><option>-l, --label <replaceable>bool</replaceable></option></term>
232+
<term><option>-g</option></term>
233+
<listitem><para>
234+
Alias for "--grid auto".
235+
</para></listitem>
236+
</varlistentry>
237+
238+
<varlistentry>
239+
<term><option>--label <replaceable>bool</replaceable></option></term>
233240
<listitem><para>
234241
Labeling [on, off]. When this is enabled, each image will be labeled with
235242
its filename. Defaults to off.
236243
</para></listitem>
237244
</varlistentry>
238245

246+
<varlistentry>
247+
<term><option>-l</option></term>
248+
<listitem><para>
249+
Alias for "--label on".
250+
</para></listitem>
251+
</varlistentry>
252+
239253
<varlistentry>
240254
<term><option>--margin-bottom <replaceable>num</replaceable></option></term>
241255
<listitem><para>

tools/chafa/chicle-options.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ print_summary (void)
254254
" --label=BOOL Labeling [on, off]. Filenames below images. Default off.\n"
255255
" -l Alias for \"--label on\".\n"
256256
" --link=BOOL Link labels [auto, on, off]. Turns labels into clickable\n"
257-
" hyperlinks. Use with \"-l on\". Defaults to auto.\n"
257+
" hyperlinks. Use with \"--label on\". Defaults to auto.\n"
258258
" --margin-bottom=NUM When terminal size is detected, reserve at least NUM\n"
259259
" rows at the bottom as a safety margin. Can be used to\n"
260260
" prevent images from scrolling out. Defaults to 1.\n"
@@ -1786,12 +1786,12 @@ chicle_parse_options (int *argc, char **argv [])
17861786
{ "exact-size", '\0', 0, G_OPTION_ARG_CALLBACK, parse_exact_size_arg, "Whether to prefer the original image size", NULL },
17871787
{ "fg", '\0', 0, G_OPTION_ARG_CALLBACK, parse_fg_color_arg, "Foreground color of display", NULL },
17881788
{ "fg-only", '\0', 0, G_OPTION_ARG_NONE, &options.fg_only, "Foreground only", NULL },
1789-
{ "fill", '\0', 0, G_OPTION_ARG_CALLBACK, parse_fill_arg, "Fill symbols", NULL },
17901789
{ "files", '\0', 0, G_OPTION_ARG_CALLBACK, parse_files_arg, "File list", NULL },
17911790
{ "files0", '\0', 0, G_OPTION_ARG_CALLBACK, parse_files0_arg, "File list (NUL-separated)", NULL },
1791+
{ "fill", '\0', 0, G_OPTION_ARG_CALLBACK, parse_fill_arg, "Fill symbols", NULL },
17921792
{ "fit-width", '\0', 0, G_OPTION_ARG_NONE, &options.fit_to_width, "Fit to width", NULL },
1793-
{ "format", 'f', 0, G_OPTION_ARG_CALLBACK, parse_format_arg, "Format of output pixel data (iterm, kitty, sixels or symbols)", NULL },
17941793
{ "font-ratio", '\0', 0, G_OPTION_ARG_CALLBACK, parse_font_ratio_arg, "Font ratio", NULL },
1794+
{ "format", 'f', 0, G_OPTION_ARG_CALLBACK, parse_format_arg, "Format of output pixel data (iterm, kitty, sixels or symbols)", NULL },
17951795
{ "fuzz-options", '\0', 0, G_OPTION_ARG_NONE, &options.fuzz_options, "Fuzz the options", NULL },
17961796
{ "glyph-file", '\0', 0, G_OPTION_ARG_CALLBACK, parse_glyph_file_arg, "Glyph file", NULL },
17971797
{ "grid", '\0', 0, G_OPTION_ARG_CALLBACK, parse_grid_arg, "Grid", NULL },
@@ -1808,7 +1808,6 @@ chicle_parse_options (int *argc, char **argv [])
18081808
{ "preprocess", 'p', 0, G_OPTION_ARG_CALLBACK, parse_preprocess_arg, "Preprocessing", NULL },
18091809
{ "probe", '\0', 0, G_OPTION_ARG_CALLBACK, parse_probe_arg, "Terminal probing", NULL },
18101810
{ "relative", '\0', 0, G_OPTION_ARG_CALLBACK, parse_relative_arg, "Relative", NULL },
1811-
{ "work", 'w', 0, G_OPTION_ARG_INT, &options.work_factor, "Work factor", NULL },
18121811
{ "scale", '\0', 0, G_OPTION_ARG_CALLBACK, parse_scale_arg, "Scale", NULL },
18131812
{ "size", 's', 0, G_OPTION_ARG_CALLBACK, parse_size_arg, "Output size", NULL },
18141813
{ "speed", '\0', 0, G_OPTION_ARG_CALLBACK, parse_anim_speed_arg, "Animation speed", NULL },
@@ -1818,6 +1817,7 @@ chicle_parse_options (int *argc, char **argv [])
18181817
{ "threshold", 't', 0, G_OPTION_ARG_CALLBACK, parse_threshold_arg, "Transparency threshold", NULL },
18191818
{ "view-size", '\0', 0, G_OPTION_ARG_CALLBACK, parse_view_size_arg, "View size", NULL },
18201819
{ "watch", '\0', 0, G_OPTION_ARG_NONE, &options.watch, "Watch a file's contents", NULL },
1820+
{ "work", 'w', 0, G_OPTION_ARG_INT, &options.work_factor, "Work factor", NULL },
18211821
/* Deprecated: Equivalent to --scale max */
18221822
{ "zoom", '\0', 0, G_OPTION_ARG_NONE, &options.zoom, "Allow scaling up beyond one character per pixel", NULL },
18231823
{ 0 }

tools/completions/zsh-completion.zsh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,26 @@ local options=(
2121
--exact-size"[Try to match the input's size exactly. Defaults to auto]:MODE:(auto on off)"
2222
--fg"[Foreground color of display (color name or hex).]:COLOR:(black blue cyan default gray green magenta orange red white)"
2323
--fg-only"[Leave the background color untouched]"
24+
--files"[Read list of files to process from PATH (newline-separated), or '-' for stdin]:FILE:_files"
25+
--files0"[Read list of files to process from PATH (NUL-separated), or '-' for stdin]:FILE:_files"
2426
--fill"[Specify character symbols to use for fill/gradients. Defaults to none]:SYMS:($symbols)"
2527
--fit-width"[Fit images to view's width, possibly exceeding their height]"
2628
--font-ratio"[Target font's width/height ratio. Can be specified as a real number or a fraction. Defaults to 1/2]:W/H"
2729
{-f,--format}"[Set output format]:FORMAT:(iterm kitty sixels symbols)"
2830
--glyph-file"[Load glyph information from FILE]:FILE:_files"
31+
--grid"[Lay out images in a grid of CxR columns/rows per screenful. C or R may be omitted, e.g. '--grid 4'. Can be 'auto']:CxR"
32+
{-g,--grid-on}"[Alias for '--grid auto']"
2933
--invert"[Invert video. For display with bright backgrounds in color modes 2 and none. Swaps --fg and --bg]"
34+
--label"[Labeling filenames below images. Defaults to off]:BOOL:(on off)"
35+
{-l,--label-on}"[Alias for '--label on']"
36+
--link"[Turns labels into clickable hyperlinks. Use with '--label on'. Defaults to auto]:MODE:(auto on off)"
3037
--margin-bottom"[When terminal size is detected, reserve at least NUM rows at the bottom as a safety margin. Can be used to prevent images from scrolling out. Defaults to 1.]:NUM"
3138
--margin-right"[When terminal size is detected, reserve at least NUM columns on the right-hand side as a safety margin. Defaults to 0.]:NUM"
3239
{-O,--optimize}"[Compress the output by using control sequences. 0 disables, 9 enables every available optimization. Defaults to 5, except for when used with '-c none', where it defaults to 0]:NUM:("{0..9}")"
3340
--passthrough"[Graphics protocol passthrough. Defaults to auto]:MODE:(auto none screen tmux)"
3441
--polite"[Polite mode. Defaults to on. Turning this off may enhance presentation and prevent interference from other programs, but risks leaving the terminal in an altered state (rude).]:BOOL:(on off)"
3542
{-p,--preprocess}"[Image preprocessing. Defaults to on with 16 colors or lower, off otherwise]:BOOL:(on off)"
43+
--probe"[Probe terminal's capabilities and wait for response. A positive real number denotes the maximum time to wait for a response, in seconds. Defaults to 5.0]:MODE:(auto on off)"
3644
--relative"[Use relative cursor positioning. Defaults to off]:BOOL:(on off)"
3745
--scale"[Scale image, respecting terminal's maximum dimensions. 1.0 approximates original pixel dimensions. Specify max to use all available space. Defaults to 1.0 for pixel graphics and 4.0 for symbols]:NUM"
3846
{-s,--size}"[Set maximum output dimensions in columns and rows. By default this will be the size of your terminal, or 80x25 if size detection fails]:WxH"

0 commit comments

Comments
 (0)