nix(feat): Add argbash support to checked-shell-script

Each postgrest- script now has a -h/--help option showing the
checked-shell-script.docs argument.

Additional CLI arguments can be defined through the
checked-shell-script.args argument using the argbash template syntax:
https://argbash.readthedocs.io/en/stable/guide.html
This commit is contained in:
Wolfgang Walther
2021-04-18 13:51:39 +02:00
committed by Wolfgang Walther
parent 39d4646a4c
commit c8edfac39e
4 changed files with 82 additions and 23 deletions
+12 -2
View File
@@ -11,6 +11,11 @@ let
{
name = "postgrest-with-${name}";
docs = "Run the given command in a temporary database with ${name}";
args =
[
"ARG_POSITIONAL_SINGLE([command], [Command to run])"
"ARG_LEFTOVERS([command arguments])"
];
inRootDir = true;
redirectTixFiles = false;
}
@@ -19,7 +24,7 @@ let
if test ! -v PGRST_DB_URI; then
export PATH=${postgresql}/bin:"$PATH"
exec ${../test/with_tmp_db} "$@"
exec ${../test/with_tmp_db} "$_arg_command" "''${_arg_leftovers[@]}"
else
"$@"
fi
@@ -40,7 +45,7 @@ let
trap 'echo "Failed on ${pg.name}"' exit
${withTmpDb pg} "$@"
${withTmpDb pg} "$_arg_command" "''${_arg_leftovers[@]}"
trap "" exit
@@ -56,6 +61,11 @@ let
{
name = "postgrest-with-all";
docs = "Run command against all supported PostgreSQL versions.";
args =
[
"ARG_POSITIONAL_SINGLE([command], [Command to run])"
"ARG_LEFTOVERS([command arguments])"
];
inRootDir = true;
}
(lib.concatStringsSep "\n\n" runners);