rig icon indicating copy to clipboard operation
rig copied to clipboard

Auto complete script for Linux using BASH is broken

Open luciorq opened this issue 2 years ago • 0 comments

The BASH Shell completion script in the current release (v.0.6.0) contains non parsable strings for the subcommand:

wget https://github.com/r-lib/rig/releases/download/latest/rig-linux-latest.tar.gz
tar -xzf rig-linux-latest.tar.gz
source share/bash-completion/completions/rig.bash

Output:

bash: share/bash-completion/completions/rig.bash: line 15: syntax error near unexpected token `____'
bash: share/bash-completion/completions/rig.bash: line 15: `            RIG ____ The R Installation Manager,add)'

By inspecting the Bash completion script, clap is really adding the wrong strings in the case statement starting at line 11.

  11   │       case "${cmd},${i}" in
  12   │             ",$1")
  13   │                 cmd="rig"
  14   │                 ;;
  15   │             RIG ____ The R Installation Manager,add)
  16   │                 cmd="RIG ____ The R Installation Manager__add"
  17   │                 ;;
  18   │             RIG ____ The R Installation Manager,available)
  19   │                 cmd="RIG ____ The R Installation Manager__available"
  20   │                 ;;
  21   │             RIG ____ The R Installation Manager,default)
  22   │                 cmd="RIG ____ The R Installation Manager__default"
  23   │                 ;;
....
 156   │             RIG ____ The R Installation Manager__system__help,help)
 157   │                 cmd="RIG ____ The R Installation Manager__system__help__help"
 158   │                 ;;
 159   │             RIG ____ The R Installation Manager__system__help,make-links)
 160   │                 cmd="RIG ____ The R Installation Manager__system__help__make__links"
 161   │                 ;;
 162   │             RIG ____ The R Installation Manager__system__help,setup-user-lib)
 163   │                 cmd="RIG ____ The R Installation Manager__system__help__setup__user__lib"
 164   │                 ;;
 165   │             *)
 166   │                 ;;
 167   │         esac

I can't really suggest any solution, but could be something changed on clap itself, since it was working properly in previous versions of rig.

Thank you for the amazing tool! Using it everyday!

luciorq avatar Nov 15 '23 15:11 luciorq