update formats and format code
This commit is contained in:
parent
3faf0e6354
commit
bee204701e
|
@ -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"];
|
||||
})
|
||||
]
|
||||
|
|
|
@ -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
|
||||
'')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue