Skip to content

Commit b259f83

Browse files
committed
Add hledger-fmt
1 parent 46d55f0 commit b259f83

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ use nix
490490
- [end-of-file-fixer](https://github.com/pre-commit/pre-commit-hooks/blob/main/pre_commit_hooks/end_of_file_fixer.py)
491491
- [fix-byte-order-marker](https://github.com/pre-commit/pre-commit-hooks/blob/main/pre_commit_hooks/fix_byte_order_marker.py)
492492
- [headache](https://github.com/frama-c/headache)
493+
- [hledger-fmt](https://github.com/mondeja/hledger-fmt)
493494
- [mixed-line-endings](https://github.com/pre-commit/pre-commit-hooks/blob/main/pre_commit_hooks/mixed_line_ending.py)
494495
- [mkdocs-linkcheck](https://github.com/byrnereese/linkchecker-mkdocs)
495496
- [openapi-spec-validator](https://github.com/python-openapi/openapi-spec-validator)

modules/hooks.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,20 @@ in
680680
};
681681
};
682682
};
683+
hledger-fmt = mkOption {
684+
description = "hledger-fmt hook";
685+
type = types.submodule {
686+
imports = [ hookModule ];
687+
options.settings = {
688+
fix =
689+
mkOption {
690+
type = types.bool;
691+
description = "Fix the files in place.";
692+
default = false;
693+
};
694+
};
695+
};
696+
};
683697
hlint = mkOption {
684698
description = "hlint hook";
685699
type = types.submodule {
@@ -3083,6 +3097,22 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.fourm
30833097
entry = "${hooks.hindent.package}/bin/hindent";
30843098
files = "\\.l?hs(-boot)?$";
30853099
};
3100+
hledger-fmt =
3101+
{
3102+
name = "hledger-fmt";
3103+
description = "Opinionated hledger's journal files formatter.";
3104+
package = tools.hledger-fmt;
3105+
entry =
3106+
let
3107+
cmdArgs = mkCmdArgs (
3108+
with hooks.hledger-fmt.settings; [
3109+
[ fix "--fix" ]
3110+
]
3111+
);
3112+
in
3113+
"${hooks.hledger-fmt.package}/bin/hledger-fmt ${cmdArgs}";
3114+
files = "\\.(hledger|journal|j)$";
3115+
};
30863116
hlint =
30873117
{
30883118
name = "hlint";

nix/tools.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
, hadolint
4040
, haskellPackages
4141
, hindent
42+
, hledger-fmt ? null
4243
, hlint
4344
, hpack
4445
, html-tidy
@@ -147,6 +148,7 @@ in
147148
gptcommit
148149
hadolint
149150
hindent
151+
hledger-fmt
150152
hlint
151153
hpack
152154
html-tidy

0 commit comments

Comments
 (0)