-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJustfile
38 lines (31 loc) · 987 Bytes
/
Justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[private]
@default:
just --list --unsorted
# Print this help message
@help: default
# Run the formatters
@fmt: fmt-fish fmt-just fmt-json fmt-lua fmt-sh
# Run the formatter for Fish
[private]
@fmt-fish *OPTS:
fd --strip-cwd-prefix --glob "**/*.fish" | rargs fish_indent --write {{ OPTS }} {}
# Run the formatter for Just
[private]
@fmt-just *OPTS:
just --unstable --fmt --quiet {{ OPTS }}
# Run the formatter for JSON
[private]
@fmt-json *OPTS:
fd --strip-cwd-prefix --glob "**/*.json" | rargs bash -c 'echo "$(gron "{}" | sort | gron --ungron)" > "{}"'
# Run the formatter for Lua
[private]
@fmt-lua *OPTS:
fd --strip-cwd-prefix --glob "**/*.lua" | rargs stylua {{ OPTS }} {}
# Run the formatter for Shell
[private]
fmt-sh *OPTS:
#!/usr/bin/env bash
sort --unique \
<(rg --glob "!Justfile" --files-with-matches "(#!/bin/sh|#!/usr/bin/env bash|# fmt=shfmt)") \
<(fd --strip-cwd-prefix --glob "**/*.sh") \
| rargs shfmt -w {{ OPTS }} {}