nix(feat): Add argbash bash completion support
This commit is contained in:
committed by
Wolfgang Walther
parent
c2df7d8198
commit
2559d32912
@@ -13,6 +13,7 @@
|
||||
{ name
|
||||
, docs
|
||||
, args ? [ ]
|
||||
, addCommandCompletion ? false
|
||||
, inRootDir ? false
|
||||
, redirectTixFiles ? true
|
||||
, withEnv ? null
|
||||
@@ -46,6 +47,17 @@ let
|
||||
runCommand "${name}-parser" { }
|
||||
"${argbash}/bin/argbash -o $out ${argsTemplate}/${name}.m4";
|
||||
|
||||
bashCompletion =
|
||||
runCommand "${name}-completion" { } (
|
||||
''
|
||||
${argbash}/bin/argbash --type completion --strip all ${argsTemplate}/${name}.m4 > $out
|
||||
''
|
||||
|
||||
+ lib.optionalString addCommandCompletion ''
|
||||
sed 's/COMPREPLY.*compgen -o bashdefault .*$/_command/' -i $out
|
||||
''
|
||||
);
|
||||
|
||||
bin =
|
||||
writeTextFile {
|
||||
inherit name;
|
||||
@@ -111,4 +123,4 @@ let
|
||||
script =
|
||||
runCommand name { inherit bin name; } "ln -s $bin/bin/$name $out";
|
||||
in
|
||||
script // { inherit bin; }
|
||||
script // { inherit bin bashCompletion; }
|
||||
|
||||
Reference in New Issue
Block a user