POC: Adding bash-completion to byobu.

* Linking repositories containing the files for future traceability (License: GPLv2)
* Symlinking the required files
* Adding bash-completion to byobu executables:
  * Hard-coding `byobu-tmux` and `byobu-screen` to respected complete-functions
  * Small shim to redirect on the correct bash-completion function
    in case of using the plain `byobu` (as expected on the normal usecase)

Tested under Ubuntu 16.04.3.

_Note that unfortunately, I didn't have screen installed to test or verify the actual
usage of `screen` file. I am not familiar with `screen` commands, but I was seeing
bash functionality "completed". However, autocomplete changed realtime to the
contents of `source`d file._

Signed-off-by: Ntentos Stavros <133706+stdedos@users.noreply.github.com>
This commit is contained in:
Ntentos Stavros 2018-05-28 23:18:14 +03:00
commit 9208fc1cdc
No known key found for this signature in database
GPG key ID: D6C10BE249198BBA
6 changed files with 27 additions and 0 deletions

6
.gitmodules vendored Normal file
View file

@ -0,0 +1,6 @@
[submodule "bash-completion"]
path = bash-completion
url = https://github.com/GArik/bash-completion.git
[submodule "tmux-bash-completion"]
path = tmux-bash-completion
url = https://github.com/imomaliev/tmux-bash-completion.git

1
bash-completion Submodule

@ -0,0 +1 @@
Subproject commit afe39fd1e171d0ea3d4fb8ec0d8c8c14fa120ed8

View file

@ -0,0 +1,17 @@
#!/bin/bash
_byobu() {
source <(sed 's/^/local /' "${HOME}/.byobu/backend")
if [ "${BYOBU_BACKEND}" == tmux ] ; then
_tmux "$@"
elif [ "${BYOBU_BACKEND}" == screen ] ; then
_screen "$@"
else
return 1
fi
}
complete -F _byobu byobu
complete -F _tmux byobu-tmux
complete -F _screen byobu-screen

View file

@ -0,0 +1 @@
bash-completion/completions/screen

1
etc/bash_completion.d/tmux Symbolic link
View file

@ -0,0 +1 @@
tmux-bash-completion/completions/tmux

1
tmux-bash-completion Submodule

@ -0,0 +1 @@
Subproject commit 847eda60c4664bfca833a086a3e2167957c26be0