dundalek / closh

Bash-like shell based on Clojure
Eclipse Public License 1.0
1.61k stars 65 forks source link

Fix shell completion bugs #162 #163

Closed johannesloetzsch closed 4 years ago

dundalek commented 4 years ago

What OS are you using?

The approach of #!/usr/bin/env -S bash -i will break on Linux (at least on Ubuntu), so it is not a good option.

I think the alternative solution might be to find out where the bash_completion script is located and add an extra path to try.

johannesloetzsch commented 4 years ago

What OS are you using?

I use the Linux Distribution NixOS.

The approach of #!/usr/bin/env -S bash -i will break on Linux (at least on Ubuntu), so it is not a good option.

The split-string option was added to coreutils in April 2018. Ubuntu should support it since 18.10

I think the alternative solution might be to find out where the bash_completion script is located and add an extra path to try.

NixOS allows having multiple versions being installed at the same time at different path at dynamic paths below /nix/store/. So an additional hardcoded path will not help.

I see 3 different ways to solve it:

  1. The shebang from this pull request requiring a not too long outdated version of coreutils.
  2. Loading _completion_loader by . $(which bash) -i into a non-interactive bash.
  3. A more dirty workaround would be, that I patch the shebang, while the nix-package is created.

How do you thing? Should we give 2. a try?

johannesloetzsch commented 4 years ago

This would evaluate the path where the bash_completion script is located at nixos

dundalek commented 4 years ago

cool, thank you :+1: