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

Can fastmod also modify hidden files? #30

Closed
kkom opened this issue May 25, 2021 · 3 comments
Closed

Can fastmod also modify hidden files? #30

kkom opened this issue May 25, 2021 · 3 comments

Comments

@kkom
Copy link

kkom commented May 25, 2021

In our codebase we have some committed .env files (it's a separate question whether that's a good idea or not...).

➜  fastmod-dot-env ls -al
total 16
drwxr-xr-x   4 konradkomorowski  staff  128 25 May 14:52 .
drwx------@ 25 konradkomorowski  staff  800 25 May 14:50 ..
-rw-r--r--   1 konradkomorowski  staff    4 25 May 14:50 .foo
-rw-r--r--   1 konradkomorowski  staff    4 25 May 14:52 foo
➜  fastmod-dot-env cat .foo 
bar
➜  fastmod-dot-env cat foo 
bar

I noticed that fastmod will ignore those:

➜  fastmod-dot-env fastmod --accept-all bar baz
➜  fastmod-dot-env cat .foo 
bar
➜  fastmod-dot-env cat foo 
baz

things work fine if I'm directly targeting that file:

➜  fastmod-dot-env fastmod --accept-all bar baz .foo 
➜  fastmod-dot-env cat .foo 
baz

But sometimes I don't know what the filenames will be (as in the case of the codemod we were running), and we are 100% confident that we want to just replace all substrings.

I tried options like -g **/* and -g */** but that didn't work.

What's the motivation for this behavior? Is there a workaround that I'm not aware of?

PS: here's my version

➜  fastmod-dot-env fastmod --version
fastmod 0.4.1
@kkom kkom changed the title Can fastmod also modify files that start with a dot? Can fastmod also modify hidden files? May 25, 2021
@swolchok
Copy link
Contributor

swolchok commented May 25, 2021

The --hidden flag was added in fastmod 0.4.2. 4d2e362

@swolchok
Copy link
Contributor

What's the motivation for this behavior?

It's the default behavior of the ignore crate, which we use to walk the filesystem (and thus of the ripgrep tool as well). We are slowly creeping toward supporting all of ripgrep's options for modifying the directory walk.

@kkom
Copy link
Author

kkom commented May 25, 2021

oh, wow, I'm sorry for not having checked the very latest version... who knew that it would be just added

well, thank you for the explanation!

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

2 participants