update formats and format code
This commit is contained in:
parent
3faf0e6354
commit
bee204701e
|
@ -11,9 +11,9 @@
|
||||||
in
|
in
|
||||||
describe "watch" [
|
describe "watch" [
|
||||||
(it "contains the command" {
|
(it "contains the command" {
|
||||||
actual = builtins.match ".*(run me).*" ( watch {
|
actual = builtins.match ".*(run me).*" (watch {
|
||||||
cmd = "run me";
|
cmd = "run me";
|
||||||
} );
|
});
|
||||||
expected = ["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'";
|
extractNix = "nix eval --impure --quiet --expr 'let r = ${getNix}; in builtins.trace r r'";
|
||||||
nixRepl = "nix repl --expr '{ r = ${getNix}; }'";
|
nixRepl = "nix repl --expr '{ r = ${getNix}; }'";
|
||||||
in (pkgs.writeShellScriptBin "test" ''
|
in (pkgs.writeShellScriptBin "test" ''
|
||||||
t=$1
|
t=''${1:-overview}
|
||||||
case "$t" in
|
case "$t" in
|
||||||
"file") echo '${resFile}' ;;
|
"file") echo '${resFile}' ;;
|
||||||
"raw") cat '${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 ;;
|
"nix") ${extractNix} | ${pkgs.alejandra}/bin/alejandra -q ;;
|
||||||
"nixrepl") ${nixRepl} ;;
|
"nixrepl") ${nixRepl} ;;
|
||||||
"nixraw") ${extractNix} ;;
|
"nixraw") ${extractNix} ;;
|
||||||
*) ${pkgs.jq}/bin/jq '${filters.overview}' '${resFile}' ;;
|
"overview") ${pkgs.jq}/bin/jq '${filters.overview}' '${resFile}' ;;
|
||||||
|
*) echo format "$t" not recognised! ;;
|
||||||
esac
|
esac
|
||||||
'')
|
'')
|
||||||
|
|
|
@ -12,9 +12,13 @@ pkgs.writeShellScriptBin "watch" ''
|
||||||
do
|
do
|
||||||
out=$(${cmd})
|
out=$(${cmd})
|
||||||
${process}
|
${process}
|
||||||
${if view == null then "" else ''
|
${
|
||||||
|
if view == null
|
||||||
|
then ""
|
||||||
|
else ''
|
||||||
echo "$out" | ${view}
|
echo "$out" | ${view}
|
||||||
''}
|
''
|
||||||
|
}
|
||||||
${pkgs.inotify-tools}/bin/inotifywait -q -e modify -r $path
|
${pkgs.inotify-tools}/bin/inotifywait -q -e modify -r $path
|
||||||
${toString stop}
|
${toString stop}
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue