Create a default global config file if it does not exist#5411
Create a default global config file if it does not exist#5411schlessera merged 17 commits intomasterfrom
Conversation
|
@schlessera The change is to handle the case when the default config doesn't exist and isn't set by The change creates a file by default if it doesn't exist at home directory, should the function |
You mean to skip creating a default one? I don't think that would be needed. Worst case if you want to avoid populating the user home folders with these files, you could always point |
schlessera
left a comment
There was a problem hiding this comment.
Just thinking now that we should actually only create the file when we try to write something in there.
Otherwise, we're cloaking the fact that there is no configuration yet.
@schlessera That is what I thought initially so that it doesn't affect other commands flow create a file only when asked so we can add param in this function and when someone uses _alias add or update create one? |
|
Yes, I think that's better. Commands can individually request whether the file should be created on-demand or not. |
|
@schlessera Updated the code to create file only when asked for, not sure why the test is failing due to that https://travis-ci.org/github/wp-cli/wp-cli/jobs/705166173#L645-L660 |
Co-authored-by: Alain Schlesser <alain.schlesser@gmail.com>
Co-authored-by: Alain Schlesser <alain.schlesser@gmail.com>
|
I think the failing test is because:
|
|
I think this might be something we should fix in |
|
Oh, as it turns out, we're already using the global config here: https://github.com/wp-cli/wp-cli-tests/blob/dfcc8b22b51d97150ee66e7655fb618b8bd460b5/features/bootstrap/FeatureContext.php#L66-L94 Then I'm not sure why that test even succeeded in the first place, though... ? |
|
Trying an easier solution for now: removing existing config files in this particular test before each run. |
|
Hmm, the |
Fixes #5327