Allow running pyfmt without ruff in the local venv
- ID
f3892da- date
2024-06-02 09:18:09+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
47ed719- message
Allow running `pyfmt` without ruff in the local venv- changed files
1 file, 10 additions, 2 deletions
Changed files
fish_functions/pyfmt.fish (219) → fish_functions/pyfmt.fish (363)
diff --git a/fish_functions/pyfmt.fish b/fish_functions/pyfmt.fish
index ac7746b..e7306f7 100644
--- a/fish_functions/pyfmt.fish
+++ b/fish_functions/pyfmt.fish
@@ -1,3 +1,11 @@
+function _run_ruff
+ if which ruff >/dev/null
+ ruff $argv
+ else
+ ~/repos/scripts/.venv/bin/ruff $argv
+ end
+end
+
function pyfmt --description "Run Python formatting over a directory"
if test (count $argv) -eq 0
set root $PWD
@@ -5,6 +13,6 @@ function pyfmt --description "Run Python formatting over a directory"
set root $argv[1]
end
- ruff check "$root"
- ruff format "$root"
+ _run_ruff check "$root"
+ _run_ruff format "$root"
end