mirror of
https://github.com/utdemir/nix-tree.git
synced 2024-10-26 23:11:57 +03:00
Add ability to check formatting
This commit is contained in:
parent
b99dc4c04f
commit
1d0c76d422
@ -38,6 +38,7 @@
|
||||
pkgs.haskellPackages.ormolu
|
||||
pkgs.haskellPackages.hlint
|
||||
pkgs.nixpkgs-fmt
|
||||
pkgs.bash
|
||||
];
|
||||
withHoogle = false;
|
||||
};
|
||||
|
20
format.sh
20
format.sh
@ -1,7 +1,19 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$1" == "check" ]]; then
|
||||
ormolu_flags="--mode check"
|
||||
nixpkgs_fmt_flags="--check"
|
||||
elif [[ "$1" == "format" ]]; then
|
||||
ormolu_flags="--mode inplace"
|
||||
nixpkgs_fmt_flags=""
|
||||
else
|
||||
echo "Usage: $0 [check|format]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
shopt -s globstar
|
||||
set -o xtrace
|
||||
|
||||
fd -e hs -X ormolu -o -XTypeApplications --mode inplace {}
|
||||
nixpkgs-fmt default.nix shell.nix flake.nix
|
||||
ormolu $ormolu_flags {src,test}/**/*.hs
|
||||
nixpkgs-fmt $nixpkgs_fmt_flags default.nix shell.nix flake.nix
|
||||
|
Loading…
Reference in New Issue
Block a user