use builtin; use str; set edit:completion:arg-completer[borgreport] = {|@words| fn spaces {|n| builtin:repeat $n ' ' | str:join '' } fn cand {|text desc| edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc } var command = 'borgreport' for word $words[1..-1] { if (str:has-prefix $word '-') { break } set command = $command';'$word } var completions = [ &'borgreport'= { cand --env-dir 'Directory to look for *.env files containing BORG_* variables for a repository.' cand --env-inherit 'Inherit BORG_* variables for a single name from the current environment.' cand --text-to 'Write the text report to instead of stdout.' cand --html-to 'Write the HTML report to .' cand --metrics-to 'Write metrics to .' cand --mail-to 'Send the report to via `sendmail`' cand --mail-from 'Send the report from instead of a default' cand --glob-archives 'Enforce a glob archives filter for all repositories.' cand --check 'Enforce to run (or not run) `borg check`' cand --check-options 'Enforce override of raw `borg check` options for all repositories.' cand --borg-binary 'Local path to a specific ''borg'' binary' cand --max-age-hours 'Threshold to warn when the last archive is older than ' cand --no-progress 'Suppress all status updates during processing.' cand --help-man 'Print an extended help message as input for `help2man`' cand -h 'Print help (see more with ''--help'')' cand --help 'Print help (see more with ''--help'')' cand -V 'Print version' cand --version 'Print version' } ] $completions[$command] }