update formats and format code

This commit is contained in:
Tristan 2024-01-03 06:54:28 +00:00
parent 3faf0e6354
commit bee204701e
4 changed files with 14 additions and 9 deletions

View file

@ -38,4 +38,3 @@
'';
};
}

View file

@ -11,9 +11,9 @@
in
describe "watch" [
(it "contains the command" {
actual = builtins.match ".*(run me).*" ( watch {
cmd = "run me";
} );
actual = builtins.match ".*(run me).*" (watch {
cmd = "run me";
});
expected = ["run me"];
})
]

View file

@ -7,14 +7,16 @@ pkgs: files: let
extractNix = "nix eval --impure --quiet --expr 'let r = ${getNix}; in builtins.trace r r'";
nixRepl = "nix repl --expr '{ r = ${getNix}; }'";
in (pkgs.writeShellScriptBin "test" ''
t=$1
t=''${1:-overview}
case "$t" in
"file") echo '${resFile}' ;;
"raw") cat '${resFile}' ;;
"json") jq '.' '${resFile}' ;;
"json") ${pkgs.jq}/bin/jq '.' '${resFile}' ;;
"explore") ${pkgs.fx}/bin/fx '${resFile}' ;;
"nix") ${extractNix} | ${pkgs.alejandra}/bin/alejandra -q ;;
"nixrepl") ${nixRepl} ;;
"nixraw") ${extractNix} ;;
*) ${pkgs.jq}/bin/jq '${filters.overview}' '${resFile}' ;;
"overview") ${pkgs.jq}/bin/jq '${filters.overview}' '${resFile}' ;;
*) echo format "$t" not recognised! ;;
esac
'')

View file

@ -12,9 +12,13 @@ pkgs.writeShellScriptBin "watch" ''
do
out=$(${cmd})
${process}
${if view == null then "" else ''
${
if view == null
then ""
else ''
echo "$out" | ${view}
''}
''
}
${pkgs.inotify-tools}/bin/inotifywait -q -e modify -r $path
${toString stop}
done