From 635dafeb9c3141518ca20f4c9c0c77cdb6f212a4 Mon Sep 17 00:00:00 2001 From: Nathan Galt Date: Tue, 27 Aug 2019 23:49:50 -0700 Subject: [PATCH] Update bat completion to support cache command Closes #6076. --- share/completions/bat.fish | 53 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/share/completions/bat.fish b/share/completions/bat.fish index 0caf7cb39..efd2ce5df 100644 --- a/share/completions/bat.fish +++ b/share/completions/bat.fish @@ -1,8 +1,8 @@ # Generated by hand against bat 0.11.0. +# bat is at . # TODO: Have --map-syntax properly suggest from- and to-languages. # NOTE: The completion for --style won’t help the user write anything in the comma-separated-list form. -# TODO: Support the `bat cache` subcommand. function __bat_complete_languages_and_extensions -d 'All languages and their filenames/extensions, one per line' command bat --list-languages | string split : | string split , @@ -55,25 +55,34 @@ set -l tabs_opts ' 8\t ' -complete -c bat -x -s l -l language -a "(__bat_complete_languages_and_extensions)" -d 'Set language for syntax highlighting' -complete -c bat -f -l list-language -d 'List supported languages for syntax highlighting' -complete -c bat -x -s m -l map-syntax -d 'Map file name/extension to existing syntax' -complete -c bat -x -l theme -a "(__bat_complete_themes)" -d 'Set theme for syntax highlighting' -complete -c bat -f -l list-themes -d 'List syntax-highlighting themes' -complete -c bat -x -l style -a "$style_opts" -d 'Choose what to add to the file contents' -complete -c bat -s p -l plain -d 'Show no decorations; -pp disables paging too' -complete -c bat -s n -l number -d 'Only show line numbers and no other decorations' -complete -c bat -s A -l show-all -d 'Show non-printable characters' -complete -c bat -x -s r -l line-range -d 'Only print lines from [M]:[N] (either optional)' -complete -c bat -x -s H -l highlight-line -d 'Highlight the given line' -complete -c bat -x -l color -ka "$color_opts" -d 'Specify when to use colors' -complete -c bat -x -l italic-text -ka "$italic_text_opts" -d 'Specify when to use ANSI italic-text sequences' -complete -c bat -x -l decorations -ka "$decorations_opts" -d 'Specify when to use --style decorations' -complete -c bat -x -l paging -ka "$paging_opts" -d 'Specify when to use a pager' -complete -c bat -x -l pager -d 'Specify what pager to use' -complete -c bat -x -l wrap -ka "$wrap_opts" -d 'Specify text-wrapping mode' -complete -c bat -x -l tabs -a "$tabs_opts" -d 'Sets tab width to N spaces' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -s l -l language -a '(__bat_complete_languages_and_extensions)' -d 'Set language for syntax highlighting' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -f -l list-language -d 'List supported languages for syntax highlighting' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -s m -l map-syntax -d 'Map file name/extension to existing syntax' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l theme -a '(__bat_complete_themes)' -d 'Set theme for syntax highlighting' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -f -l list-themes -d 'List syntax-highlighting themes' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l style -a "$style_opts" -d 'Choose what to add to the file contents' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -s p -l plain -d 'Show no decorations; -pp disables paging too' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -s n -l number -d 'Only show line numbers and no other decorations' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -s A -l show-all -d 'Show non-printable characters' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -s r -l line-range -d 'Only print lines from [M]:[N] (either optional)' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -s H -l highlight-line -d 'Highlight the given line' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l color -ka "$color_opts" -d 'Specify when to use colors' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l italic-text -ka "$italic_text_opts" -d 'Specify when to use ANSI italic-text sequences' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l decorations -ka "$decorations_opts" -d 'Specify when to use --style decorations' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l paging -ka "$paging_opts" -d 'Specify when to use a pager' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l pager -d 'Specify what pager to use' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l wrap -ka "$wrap_opts" -d 'Specify text-wrapping mode' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l tabs -a "$tabs_opts" -d 'Sets tab width to N spaces' # Don’t suggest the always-ignored added-only-for-POSIX-compliance -u/--unbuffered. Output is always unbuffered. -complete -c bat -x -l terminal-width -d 'Explicitly set terminal width, optionally prefixed with +/-' -complete -c bat -s h -l help -d 'Print help' -complete -c bat -s V -l version -d 'Show version information' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -x -l terminal-width -d 'Explicitly set terminal width, optionally prefixed with +/-' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -s h -l help -d 'Print help' +complete -c bat -n 'not __fish_seen_subcommand_from cache' -s V -l version -d 'Show version information' + +# cache things +complete -c bat -n '__fish_use_subcommand' -a cache -d 'Manage syntax-definition and theme cache' +complete -c bat -n '__fish_seen_subcommand_from cache' -f -s b -l build -d 'Initialize/update cache from the source directory' +complete -c bat -n '__fish_seen_subcommand_from cache' -f -s c -l clear -d 'Remove cached definitions and themes' +complete -c bat -n '__fish_seen_subcommand_from cache' -r -l source -d 'Specify directory to load syntaxes/themes from' +complete -c bat -n '__fish_seen_subcommand_from cache' -r -l target -d 'Specify directory to store cached syntaxes/themes' +complete -c bat -n '__fish_seen_subcommand_from cache' -f -l blank -d 'Create completely new syntax/theme sets instead of appending to the defaults' +complete -c bat -n '__fish_seen_subcommand_from cache' -f -s h -l help -d 'Print help about cache management'