Repository: sharkdp/bat (language: rust)

Issue:
ZSH tab completion breaks if first argument is a flag
```
$ bat --version
bat 0.16.0
```
**Describe the bug you encountered:**
`bat <TAB>` autocompletes properly with ZSH, however `bat -p <TAB>` does not.
I think this is a recent regression.

**How did you install `bat`?**
https://www.archlinux.org/packages/community/x86_64/bat/

---

system
------

**$ uname -srm**
Linux 5.4.71-1-lts x86_64  

**$ lsb_release -a**
LSB Version:	1.4  
Distributor ID:	Arch  
Description:	Arch Linux  
Release:	rolling  
Codename:	n/a  

bat
---

**$ bat --version**
bat 0.16.0  

**$ env**
BAT_THEME=Solarized (dark)  

bat_config
----------

bat_wrapper
-----------

No wrapper script for 'bat'.

bat_wrapper_function
--------------------

No wrapper function for 'bat'.

**$ /bin/zsh --login -i -c type cat**
```
cat is an alias for bat -pp
```

tool
----

**$ less --version**
less 551 (PCRE regular expressions)  



Discussion / hints:

Fix patch:
diff --git a/assets/completions/bat.zsh.in b/assets/completions/bat.zsh.in
index cef5daaaa9..edaf7aee35 100644
--- a/assets/completions/bat.zsh.in
+++ b/assets/completions/bat.zsh.in
@@ -3,8 +3,8 @@
 local context state state_descr line
 typeset -A opt_args
 
-(( $+functions[_cache_subcommand] )) ||
-_cache_subcommand() {
+(( $+functions[_{{PROJECT_EXECUTABLE}}_cache_subcommand] )) ||
+_{{PROJECT_EXECUTABLE}}_cache_subcommand() {
     local -a args
     args=(
         '(-b --build -c --clear)'{-b,--build}'[Initialize or update the syntax/theme cache]'
@@ -19,12 +19,12 @@ _cache_subcommand() {
     _arguments -S -s $args
 }
 
-(( $+functions[_main] )) ||
-_main() {
+(( $+functions[_{{PROJECT_EXECUTABLE}}_main] )) ||
+_{{PROJECT_EXECUTABLE}}_main() {
     local -a args
     args=(
         '(-A --show-all)'{-A,--show-all}'[Show non-printable characters (space, tab, newline, ..)]'
-        {-p,--plain}'[Show plain style (alias for `--style=plain`)]:When `-p` is used twice (`-pp`), it also disables automatic paging (alias for `--style=plain --paging=never`)'
+        '*'{-p,--plain}'[Show plain style (alias for `--style=plain`), repeat twice to disable disable automatic paging (alias for `--paging=never`)]'
         '(-l --language)'{-l+,--language=}'[Set the language for syntax highlighting]:<language>:->language'
         '(-H --highlight-line)'{-H,--highlight-line}'[Highlight lines N through M]:<N\:M>...'
         '(--file-name)'--file-name'[Specify the name to display for a file]:<name>...:_files'
@@ -51,13 +51,13 @@ _main() {
 
     _arguments -S -s $args
 
-    case "$state" in 
+    case "$state" in
         language)
             local IFS=$'\n'
             local -a languages
             languages=( $({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') )
 
-            _describe 'language' languages 
+            _describe 'language' languages
         ;;
 
         theme)
@@ -79,15 +79,15 @@ if (( ${#words} == 2 )); then
     local -a subcommands
     subcommands=('cache:Modify the syntax-definition and theme cache')
     _describe subcommand subcommands
-    _main
+    _{{PROJECT_EXECUTABLE}}_main
 else
     case $words[2] in
         cache)
-            _cache_subcommand
+            _{{PROJECT_EXECUTABLE}}_cache_subcommand
         ;;
 
         *)
-            _main
+            _{{PROJECT_EXECUTABLE}}_main
         ;;
     esac
 fi


Test patch: