home.pbsds: avoid 'complete' in bashMinimal/headless

This commit is contained in:
2026-06-05 16:53:18 +02:00
parent 0e62475587
commit a6b2f6aebd
6 changed files with 19 additions and 7 deletions
+2
View File
@@ -14,10 +14,12 @@
];
programs.bash.shellInit = ''
if command -v complete >/dev/null; then
if [ -n "''${BASH_VERSION:-}" ]; then
complete -F _command steam-run
# complete -F _command fhs-run
fi
fi
'';
/** /
+9 -7
View File
@@ -61,13 +61,15 @@ in {
#ls -l "$_JUMP_MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
command ls --color=always -l "$_JUMP_MARKPATH" | tr -s ' ' | cut -d' ' -f9- | sed -e 's/ -> /§/g' | column -t -s '§' -o ' -> '
}
_complete_jump_marks() {
local curw=''${COMP_WORDS[COMP_CWORD]}
local wordlist=($(find "$_JUMP_MARKPATH" -type l -printf "%f\n"))
COMPREPLY=($(compgen -W "''${wordlist[@]}" -- "$curw"))
return 0
}
complete -F _complete_jump_marks jump unmark
if command -v complete >/dev/null; then
_complete_jump_marks() {
local curw=''${COMP_WORDS[COMP_CWORD]}
local wordlist=($(find "$_JUMP_MARKPATH" -type l -printf "%f\n"))
COMPREPLY=($(compgen -W "''${wordlist[@]}" -- "$curw"))
return 0
}
complete -F _complete_jump_marks jump unmark
fi
'';
in {
# TODO: fish
@@ -29,10 +29,12 @@
# TODO: add remote-exec once packaged
programs.bash.initExtra = ''
# remote-exec
if command -v complete >/dev/null; then
if command -v remote >/dev/null && command -v remote-quick >/dev/null; then
complete -F _command remote
complete -F _command remote-quick
fi
fi
'';
home.packages = with pkgs; [
@@ -13,10 +13,12 @@
sshuttle 0.0.0.0/0 ::/0 --dns -r "$1" -x $ip -x 127.0.0.1 -x 172.0.0.0/8
)
if command -v complete >/dev/null; then
if test -f ~/.ssh/config; then
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" vpn
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" lvpn
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" dvpn
fi
fi
'';
}
@@ -32,9 +32,11 @@ in
programs.bash.historyIgnore = [ "ls" "file" "cat" "type" "exit" ];
programs.bash.initExtra = ''
# tldr
if command -v complete >/dev/null; then
if command -v tldr >/dev/null; then
complete -F _command tldr
fi
fi
'';
# ~/.inputrc
@@ -7,6 +7,7 @@
programs.bash.initExtra = ''
# ssh autocomplete
if command -v complete >/dev/null; then
if [[ -f ~/.ssh/config ]]; then
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" ssh
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" tssh
@@ -19,6 +20,7 @@
complete -W "$(cat ~/.ssh/config | grep "^Host " | cut -d" " -f2- | grep -v '\*')" remote-add
fi
fi
fi
'';
programs.ssh.enable = true;