Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add hidden flag to traverse hidden files #250

Merged
merged 1 commit into from
Oct 15, 2023

Conversation

a-kenji
Copy link
Contributor

@a-kenji a-kenji commented Sep 23, 2023

Add the hidden and no-hidden flag that allows configuring the traversal of hidden files.

Examples:

treefmt --hidden

will traverse hidden files.

treefmt --hidden --no-hidden

will not traverse hidden files, same as the default (treefmt).

treefmt --hidden --no-hidden --hidden

will traverse hidden files.

@a-kenji a-kenji force-pushed the feat/hidden-flag branch 2 times, most recently from 3af310e to 0af647c Compare September 23, 2023 12:46
clippy.toml Show resolved Hide resolved
@a-kenji a-kenji force-pushed the feat/hidden-flag branch 2 times, most recently from ad5bcfc to 181ec88 Compare September 24, 2023 18:28
@zimbatm
Copy link
Member

zimbatm commented Sep 28, 2023

Thanks, I missed this PR before cutting the release.

I don't know precisely what use-case you have in mind, but wouldn't it make more sense to add the flag in the treefmt.toml config file? I suspect that the setting should be project-specific.

@a-kenji
Copy link
Contributor Author

a-kenji commented Sep 29, 2023

No worries.

I don't know precisely what use-case you have in mind, but wouldn't it make more sense to add the flag in the treefmt.toml config file? I suspect that the setting should be project-specific.

Oh yeah, good call. I will add a [global] configuration option.

For now my use-case would be uncovering hidden files that would be matched and then manually adding them to the treefmt.toml. In essence a helper for initializing project specific settings. But I imagine the flexibility can be useful in general. I don't really want to encourage by default for people to have to add the hidden option to traverse hidden files once or twice and then it stays there without really being wanted/needed.

In the future in regards to #244. Showing files that are covered/uncovered showing by default files that are not hidden, but optionally showing coverage of hidden files as well.

@zimbatm
Copy link
Member

zimbatm commented Sep 29, 2023

I think you're right, if it's in the config it would always format the .git folder as well, and that wouldn't be what we want either.

Let's just keep the command-line flag for now, since it helps with your use-case. Until we find a better way to make those distinctions as you mention with 244

@a-kenji a-kenji force-pushed the feat/hidden-flag branch 2 times, most recently from 8d21bc9 to a82fa8d Compare October 3, 2023 11:10
@a-kenji
Copy link
Contributor Author

a-kenji commented Oct 3, 2023

I have rebased on top of main in order to make use of the testing system, and added tests for the hidden flag.

The exclude and gitignore files are respected when traversing with the --hidden flag, but as you said the .git folder will be traversed.

Add the `hidden` and `no-hidden` flag that allows
configuring the traversal of hidden files.

Examples:

```
treefmt --hidden
```
will traverse hidden files.

```
treefmt --hidden --no-hidden
```
will not traverse hidden files, same as the default (`treefmt`).

```
treefmt --hidden --no-hidden --hidden
```
will traverse hidden files.
@zimbatm zimbatm merged commit 67d3c55 into numtide:main Oct 15, 2023
15 checks passed
@zimbatm
Copy link
Member

zimbatm commented Oct 15, 2023

thanks!

@a-kenji a-kenji deleted the feat/hidden-flag branch October 15, 2023 08:24
@nokazn nokazn mentioned this pull request Jan 4, 2024
@benluelo benluelo mentioned this pull request Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants