dnaeon / clingon

Command-line options parser system for Common Lisp
Other
122 stars 7 forks source link

completions.bash doesn't work. #20

Closed arkdae closed 8 months ago

arkdae commented 8 months ago

I'm running:

GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

The first problem I find is: bash: _init_completion: command not found

So I delete that line since I really don't know what it is even supposed to do. And then I get:

bash: --bash-completions: command not found
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E

I tried changing the line noise: "${words[@]:0:${cword}}"

to be simply $1, but while it now displays the list of subcommands, it doesn't fill in one of them if I've got a unique partial match (which I assume is what bash completion is supposed to do). I suspect I need some of the magic in that line noise.

dnaeon commented 8 months ago

Hey @arkdae ,

Did you follow the instructions from https://github.com/dnaeon/clingon#bash-completions ?

Can you provide steps to reproduce your issue?

Thanks, Marin

arkdae commented 8 months ago

Yes, I believe I have:

5> APP=clackman source extras/completions.bash 
6> clackman bash: _init_completion: command not found
dnaeon commented 8 months ago

Hey @arkdae ,

Please make sure that you have the bash-completion package installed on your system.

I've updated the instructions at https://github.com/dnaeon/clingon#bash-completions to specify that you need this package as well.

Also, I've updated the completions.bash script. Please try it out again and let know how it goes.

Thanks!

arkdae commented 8 months ago

Thanks, it is working now. Sorry, I was not aware that Bash does not come with completion functionality, particularly since I do see that it completes filenames automatically.