Skip to content

Commit

Permalink
doc: refine usage
Browse files Browse the repository at this point in the history
Signed-off-by: Brian McGee <[email protected]>
  • Loading branch information
brianmcgee committed May 2, 2024
1 parent 17f354b commit f1c80ed
Showing 1 changed file with 17 additions and 25 deletions.
42 changes: 17 additions & 25 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ treefmt [FLAGS] [OPTIONS] [--] [paths]...

> Only apply selected formatters. Defaults to all formatters.
`-H, --hidden`

> Also traverse hidden files (files that start with a .). This behaviour can be overridden with the `--no-hidden` flag.
`--no-hidden`

> Override the `--hidden` flag. Don't traverse hidden files.
`--tree-root <tree-root>`

> Set the path to the tree root directory where treefmt will look for the files to format. Defaults to the folder holding the `treefmt.toml` file. It’s mostly useful in combination with `--config-file` to specify the project root which won’t coincide with the directory holding `treefmt.toml`.
Expand All @@ -92,24 +84,24 @@ Typically, you would use treefmt in the CI with the `--fail-on-change` and `--no

You can you set a `treefmt` job in the GitHub pipeline for Ubuntu with nix-shell like this:

```
```yaml
name: treefmt
on:
pull_request:
push:
branches: main
pull_request:
push:
branches: main
jobs:
formatter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v10
with:
name: nix-community
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: treefmt
run: nix-shell --run "treefmt --fail-on-change --no-cache"
formatter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v10
with:
name: nix-community
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: treefmt
run: nix-shell --run "treefmt --fail-on-change --no-cache"
```

0 comments on commit f1c80ed

Please sign in to comment.