From bee204701e3308980b1d32461d89054c73d29f5f Mon Sep 17 00:00:00 2001 From: Tristan Date: Wed, 3 Jan 2024 06:54:28 +0000 Subject: [PATCH] update formats and format code --- flake.nix | 1 - test/watch.test.nix | 6 +++--- tix/run.nix | 8 +++++--- tix/watch.nix | 8 ++++++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 2e66630..f8a8704 100644 --- a/flake.nix +++ b/flake.nix @@ -38,4 +38,3 @@ ''; }; } - diff --git a/test/watch.test.nix b/test/watch.test.nix index 44fa907..595a2bc 100644 --- a/test/watch.test.nix +++ b/test/watch.test.nix @@ -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"]; }) ] diff --git a/tix/run.nix b/tix/run.nix index f2cb88f..8598edb 100644 --- a/tix/run.nix +++ b/tix/run.nix @@ -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 '') diff --git a/tix/watch.nix b/tix/watch.nix index 548d776..3d2079e 100644 --- a/tix/watch.nix +++ b/tix/watch.nix @@ -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