nix(feat): Add argbash bash completion support

This commit is contained in:
Wolfgang Walther
2021-04-18 13:51:39 +02:00
committed by Wolfgang Walther
parent c2df7d8198
commit 2559d32912
9 changed files with 113 additions and 68 deletions
+14 -8
View File
@@ -1,7 +1,9 @@
{ buildEnv
{ bashCompletion
, buildEnv
, checkedShellScript
, lib
, postgresqlVersions
, writeTextFile
}:
let
# Wrap the `test/with_tmp_db` script with the required dependencies from Nix.
@@ -16,6 +18,7 @@ let
"ARG_POSITIONAL_SINGLE([command], [Command to run])"
"ARG_LEFTOVERS([command arguments])"
];
addCommandCompletion = true;
inRootDir = true;
redirectTixFiles = false;
}
@@ -66,6 +69,7 @@ let
"ARG_POSITIONAL_SINGLE([command], [Command to run])"
"ARG_LEFTOVERS([command arguments])"
];
addCommandCompletion = true;
inRootDir = true;
}
(lib.concatStringsSep "\n\n" runners);
@@ -73,18 +77,20 @@ let
# Create a `postgrest-with-postgresql-` for each PostgreSQL version
withVersions = builtins.map withTmpDb postgresqlVersions;
tools = [ withAll ] ++ withVersions;
bashCompletion = builtins.map (tool: tool.bashCompletion) tools;
in
buildEnv
{
name =
"postgrest-with";
"postgrest-withtools";
paths = builtins.map (tool: tool.bin) tools;
} // {
inherit bashCompletion;
paths =
[
withAll.bin
] ++ (builtins.map (v: v.bin) withVersions);
}
# make withTools.latest available for other nix files
// {
latest = withTmpDb (builtins.head postgresqlVersions);
}