summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-08-01 13:17:30 +0200
committertv <tv@krebsco.de>2023-08-01 13:17:30 +0200
commitf091cd5e03b5abed95c68c80a4df8af2dbcabedc (patch)
treee04e621003cedd16dde3ab217e8fcfca3ecfdd8a /krebs/5pkgs
parent7be9bfdc55d672de39dce98dae9c6d112404dfc6 (diff)
brain: add bash-completion
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/simple/brain/default.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/krebs/5pkgs/simple/brain/default.nix b/krebs/5pkgs/simple/brain/default.nix
index 9b125862b..bf52da75f 100644
--- a/krebs/5pkgs/simple/brain/default.nix
+++ b/krebs/5pkgs/simple/brain/default.nix
@@ -1,4 +1,4 @@
-{ pass, write, writeDash, ... }:
+{ pass, runCommand, write, writeDash, ... }:
write "brain" {
"/bin/brain".link = writeDash "brain" ''
@@ -9,4 +9,14 @@ write "brain" {
PASSWORD_STORE_DIR=$HOME/brain \
exec ${pass}/bin/passmenu $@
'';
+ "/share/bash-completion/completions/brain".link =
+ runCommand "brain-completions" {
+ } /* sh */ ''
+ sed -r '
+ s/\<_pass?(_|\>)/_brain\1/g
+ s/\<__password_store/_brain/g
+ s/\<pass\>/brain/
+ s/\$HOME\/\.password-store/$HOME\/brain/
+ ' < ${pass}/share/bash-completion/completions/pass > $out
+ '';
}