-
-
Notifications
You must be signed in to change notification settings - Fork 844
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
Is there a global configuration file #362
Comments
Not yet, no. Certainly could be useful to support that. Until then, you can always set up an alias, e.g. |
I've thought about this again, and I think that I'd like to avoid adding a config file for |
`fd` does not support global configuration file. sharkdp/fd#362
The problem with aliases is that when you use For example in |
Opening for further discussion. I'm not completely opposed to this idea. |
I thought about this again. I really like the fact that Sure, we could add a |
Actually So finally we want the same thing : having the same behavior everywhere. But probably we do not put the same meaning in "the same behavior " ;) |
I think that's more like saying: (you might be interested in #612) |
As you see we don't agree (and we can't, because we are different persons not robots ;)) what should be the default behavior. This is why the configuration file is important, to make happy everybody about what the "default" behavior should be. If you don't want it, you don't use it : just do not put a configuration file in your computer. Almost all cli have the possibility to use configuration file for this reason, and it was never considered as weakness, as far as I know. |
@kpym Perhaps you can write a new language that compiles basic aliases and shell functions into different languages (bash, powershell, etc). This way, you can solve the problem systematically, in a way that scales. I think lots of people will like that. |
@kpym Another solution is to create a wrapper using, e.g., python. |
@kpym consider: if I made a useful program which assumed fd respects .gitignore. then you try to use this tool, but it breaks because of your configuration to ignore .gitignore files. Of course you don't realize that's why it broke so you just think my tool doesn't work. This is why global configuration for cli tools used in scripting is a bad idea. Grep doesn't have a config file, but it did support setting default options with an environment variable. This was later realized to be a mistake, because setting that environment variable could easily break scripts, and use of that environment variable has been deprecated. |
@tmccombs Perhaps having a
If it were so obvious and consensual probably all cli tools would have done the same. There are pros and cons. The Idea is to make more people happy, IMO ;) The question is how to satisfy those who want a global configuration and those who are afraid that this configuration will break their scripts. My proposal is to allow global configuration to satisfy the first ones (me included) and to put a switch to ignore this configuration to satisfy the second ones (like you and @sharkdp if I understood well). |
What other unix-filter style cli tools have configuration files? Afaik, things like find, sed, ls, etc. do not have configuration files. |
@tmccombs What other unix-filter style cli tools use And what about |
My vote goes for adding something akin to ripgrep's approach with an optional RIPGREP_CONFIG_PATH environment variable. |
I think this is not (specifically) related the config file discussion. Using Imagine Things that might be okay to be configurable would be settings that do not change the search results. Like whether or not you want |
@sharkdp As already pointed heaving Adding a flag in a script is not so much efforts compared to adding a flag every time we type |
Well, that's what
Ok, serious question. I'm not a Windows user. Why are people still using If |
One issue with aliases that I ran into recently is that they don’t play well with |
FWIW, I basically had the same stance as @sharkdp here before I gave in and added config file support to ripgrep. I found the environment variable solution to be nice because it requires someone to explicitly set it and doesn't require needing to know anything about platform specific config files. The user just gets to choose, full stop. I think Windows was my primary motivation because there are weird aspects about creating aliases on Windows, although those things might impact ripgrep more severely than fd. And then of course there are circumstances where aliases can't be used (or can't be used easily). Although, my stance there was to just create a wrapper script and drop it into IMO, there is some good motivation for a config file largely not because there are work-arounds, but because users find it convenient. But I also think it's justifiable to resist adding the complexity. As others have mentioned, there are real downsides to config files, particularly when |
Just putting in my two cents; I'm in favor of an environment-variable-controlled config, though I don't personally think it will be as useful for Yes, many of those file types would be classified as binary data, and not searched by default, but I had my reasons for adding them anyways. I don't remember what those reasons were, but I very clearly remember having had them! |
I thought I'd 👍 the use of an environment variable to point to a Just this week I found a use for Unfortunately, using a shell Thanks a lot for the excellent utility. |
The Also, an alternative to a shell alias is a simple shell wrapper script. |
@BurntSushi thank you. I just tried out a shell wrapper ("shim") but it's not working quite as I expected, and my guess is it comes down to how nvim-telescope executes The use of At any rate, this is a much better solution than what I had been using, and I'll pass it on to other telescope users on the team. |
Regarding the point that not allowing global config allows |
A big issue for me with aliases/functions is they don't work with |
@dylan-tock a wrapper script would work with |
A few additional thoughts:
|
@tmccombs a wrapper script would work for that. |
I had a thought. What if we checked if stdout is a tty (which we already do for color output). If it is a tty, we load a config file, if any. If not, we assume it is being use programmaticly, and shouldn't load config. And also have flags for forcing config loading off or on. The downside to that is a user might run fd and get one output, then run it again piping the result to something else, and get very different results. Or perhaps we could support loading config, but you have to opt into it with a flag. So you would still need an alias, but it could just have one flag that points to a file that has other options to use. |
I was thinking about this, but that downside seems awful. I'm glad you caught it. I guess what was meant, is config for "interactive" use as in, I'm typing If there's no reliable way of telling these apart, then no config is better as scripting will stay uniform (you don't want tools built on top of |
Is there a global configuration file option (
.fdrc
?) that can be used to always use the same options?The text was updated successfully, but these errors were encountered: