Raku / App-Rakubrew

Raku environment manager
https://rakubrew.org/
Other
26 stars 13 forks source link

Add completion for `help` and `available` commands plus fix Bash completion #29

Closed mendel closed 3 years ago

mendel commented 3 years ago

This PR contains the following improvements to the completion functionality:

patrickbkr commented 3 years ago

I've been staring at this for quite a while now, and now I actually see what went wrong with the Bash backend. 9fb2494 did not trigger a bug, but introduce one. The offending line is in 2425ca4. The command name is now removed by strip_executable, which also adapts the index accordingly. The shift @words was removed accordingly, but not the $index -1. So this change is actually the correct fix. Thanks @mendel++

@JJ Testing has always been a sore point of Rakubrew. One of the reasons is that I never had a clever idea of how to write good tests with the biggest part of Rakubrew being integration code interfacing with external components (shells, git, filesystems, builds tools, ...). Do you have an idea of how to approach this? I suspect this will be a bigger challenge, so I opt to merge this PR now and tackle testing separately.