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

@ -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
'') '')

View file

@ -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