mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 13:24:01 +08:00
Create bat.fish
This commit is contained in:
parent
4c656dd43e
commit
dd34bf0ba6
79
share/completions/bat.fish
Normal file
79
share/completions/bat.fish
Normal file
|
@ -0,0 +1,79 @@
|
|||
# Generated by hand against bat 0.11.0.
|
||||
|
||||
# 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 ,
|
||||
end
|
||||
|
||||
function __bat_complete_language_extensions -d 'All language extensions/names, one per line'
|
||||
command bat --list-languages | cut -d : -f 2 | string split ,
|
||||
end
|
||||
|
||||
function __bat_complete_themes -d 'All themes, one per line'
|
||||
command bat --list-themes
|
||||
end
|
||||
|
||||
set -l style_opts '
|
||||
auto\tdefault
|
||||
full\t
|
||||
plain\t
|
||||
changes\t
|
||||
header\t
|
||||
grid\t
|
||||
numbers\t
|
||||
'
|
||||
|
||||
set -l color_opts '
|
||||
auto\tdefault
|
||||
never\t
|
||||
always\t
|
||||
'
|
||||
|
||||
set -l italic_text_opts '
|
||||
always\t
|
||||
never\tdefault
|
||||
'
|
||||
|
||||
set -l decorations_opts "$color_opts"
|
||||
set -l paging_opts "$color_opts"
|
||||
|
||||
set -l wrap_opts '
|
||||
auto\tdefault
|
||||
never\t
|
||||
character\t
|
||||
'
|
||||
|
||||
# While --tabs theoretically takes any number, most people should be OK with these. Specifying a list lets me explain what 0 does.
|
||||
set -l tabs_opts '
|
||||
0\tpasses tabs through directly
|
||||
1\t
|
||||
2\t
|
||||
4\t
|
||||
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'
|
||||
# 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'
|
Loading…
Reference in New Issue
Block a user