Opposing/negating command-line options (eg. --no-hidden) #595
Comments
|
Thank you for the feedback and for the detailed feature request. I agree with all points. To keep the
fd --exclude '*.bkp' --glob 'example*'However,
|
|
May be another possibility is to have For example In this way you could use variable as values, like |


Background
First off, let me just say that I love your projects,
batandfdare great and I use them both regularly.What I was looking for was something similar to the
--no-hiddenoption as it exists in ripgrep. As in fd, in ripgrep hidden files are not searched by default. However with ripgrep I can create a global config that effectively changes it's behavior to search hidden files by default, and then still be able to pass a--no-hiddenoption in order to turn it back off on a case by case basis when desired. The logic that parses the command-line options would simply let subsequent opposing command-line options override prior ones. When I was looking around to see if this was possible, I found #362 where a global config file that was previously proposed, and I agree that aliases adequately satisfy the same use case.Proposal
If so-called "opposing" command-line options such as
--no-hiddenwere supported. Then it would be possible to define aliases such aswhich would effectively change the default options to search hidden files, and then if you wanted to ignore hidden files you could run something like:
Similarly other "opposing" command-line options could be added where applicable, for example the currently supported
--no-ignorecould be complemented with a new--ignoreoption.Just briefly looking at the currently supported options, here are some of the ones I feel could possibly be useful:
Note that I haven't tested it, but for some currently supported options, this may or may not already be possible:
How do you feel about this? If you would be interested in supporting anything like this in fd that would be awesome. If it helped, I could offer to write an initial implementation. I do have a full-time day job so depending on how involved it ended up being I couldn't guarantee how quickly I could finish it, but I would definitely find some time to do it sooner or later. I would expect that the necessary changes would be mostly, if not fully contained within the command-line parsing logic, but I haven't actually looked into it so you never know.
The text was updated successfully, but these errors were encountered: