Commit Graph

7 Commits

Author SHA1 Message Date
Brian McGee
9934a5764d
fix: --stdin flag
This was incorrectly ported from Rust to Go.

When provided, `treefmt` will take the contents of stdin and place them into the file provided with the `--stdin` flag, then format it according to the configured formatters.

If the file doesn't exist it is created. If it exists, it is first truncated and then populated with stdin.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-06-03 17:07:34 +01:00
Brian McGee
bbe50fbe75
doc: refine --on-unmatched usage
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-29 10:32:02 +01:00
Brian McGee
1b517c6502
feat: add --on-unmatched
By default, if a path does not match any formatter a log message at WARN level will be emitted. A user can change this by providing the `--on-unmatched` or `-u` flag and specifying a log level `debug,info,warn,error,fatal`.

If fatal, the process will exit with an error on the first unmatched path encountered.

Closes #302

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-29 10:32:02 +01:00
Brian McGee
e5da10e873
doc: refine docs and usage
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-10 10:46:39 +01:00
Brian McGee
e3fabb17e8
doc: update usage with info about walkers.
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-02 11:52:29 +01:00
Brian McGee
f1c80edcf1
doc: refine usage
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-02 11:41:38 +01:00
Brian McGee
73722737f6
doc: port existing content
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-02 11:41:36 +01:00