@@ -1,4 +1,4 @@
1−#compdef bat
1+#compdef {{PROJECT_EXECUTABLE}}
22
33local context state state_descr line
44typeset -A opt_args
@@ -19,8 +19,8 @@ _cache_subcommand() {
1919 _arguments -S -s $args
2020}
2121
22−(( $+functions[_bat_main] )) ||
23−_bat_main() {
22+(( $+functions[_main] )) ||
23+_main() {
2424 local -a args
2525 args=(
2626 '(-A --show-all)'{-A,--show-all}'[Show non-printable characters (space, tab, newline, ..)]'
@@ -55,7 +55,7 @@ _bat_main() {
5555 language)
5656 local IFS=$'\n'
5757 local -a languages
58− languages=( $(bat --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') )
58+ languages=( $({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') )
5959
6060 _describe 'language' languages
6161 ;;
@@ -63,7 +63,7 @@ _bat_main() {
6363 theme)
6464 local IFS=$'\n'
6565 local -a themes
66− themes=( $(bat --list-themes | sort) )
66+ themes=( $({{PROJECT_EXECUTABLE}} --list-themes | sort) )
6767
6868 _values 'theme' $themes
6969 ;;
@@ -79,7 +79,7 @@ if (( ${#words} == 2 )); then
7979 local -a subcommands
8080 subcommands=('cache:Modify the syntax-definition and theme cache')
8181 _describe subcommand subcommands
82− _bat_main
82+ _main
8383else
8484 case $words[2] in
8585 cache)
@@ -87,7 +87,7 @@ else
8787 ;;
8888
8989 *)
90− _bat_main
90+ _main
9191 ;;
9292 esac
9393fi