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

Proposal: Support ignore all subdirectories by a single option. #1234

Open
And-ZJ opened this issue Feb 12, 2025 · 3 comments
Open

Proposal: Support ignore all subdirectories by a single option. #1234

And-ZJ opened this issue Feb 12, 2025 · 3 comments

Comments

@And-ZJ
Copy link

And-ZJ commented Feb 12, 2025

Hello, thanks for the tools.
So far I've found that, by default, when you supply a directory, the tool counts the code in that directory and all its subdirectories.
But sometimes, I just want to count the current directory, not the subdirectories.
I took a quick look and there doesn't seem to be a single such option.
If the --exclude parameter is used, it is troublesome when there are many subdirectories.
I wish it could provide an option to ignore all subdirectories.
Thank you!

@JackDyre
Copy link

If the maintainers are in support of this, I am willing to try my hand at implementing this.

@Swiddis
Copy link

Swiddis commented Feb 19, 2025

An approach mentioned back in #676 was that we could support a wider range of use cases by allowing Tokei to optionally take a file list from stdin, which would then let it be piped into with find. Taking the proposed syntax from there, traversing a directory for files non-recursively would be done with something like find . -maxdepth 1 -type f | tokei -.

@And-ZJ
Copy link
Author

And-ZJ commented Feb 20, 2025

Thank you! Yes, find . -maxdepth 1 -type f | tokei - is a good way to do it.

However, I actually wrote a piece of Go code to invoke this tool. This way of writing increases the complexity of writing code. That's why I had this idea. I hope you'll think about it again. Thank you.

@And-ZJ And-ZJ changed the title Proposal: Support ignore all subdirectories by a singal option. Proposal: Support ignore all subdirectories by a single option. Feb 20, 2025
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

No branches or pull requests

3 participants