-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Add cli option --config-file #459
Conversation
8677214
to
dd86e61
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a crack at this! This is something that I'd use, so I definitely appreciate it!
I think this could be a smaller PR with fewer changes if you follow my suggestion of adding a global to remember the config file path.
Thanks for the review! the code is indeed simpler now 😃 I don't know how you prefer to do code reviews, so I didn't marked your comments as resolved, so you can see my answers and mark then as resolved if it is ok for you. |
When the config is given explicitely (either using --config-file or via WEZTERM_CONFIG_FILE), failing to load this file will use the default config. Otherwise the config file is searched one by one in a few directories.
Replying to #459 (comment)
It should be done now! tested locally, it works great! I didn't it implemented with the enum you suggested though, I found it was quite hard to use in the for loop over paths items. I hope you like it 😃 |
Thanks! |
Youhou, thank you 😊 |
It works! 🎉
I didn't find a documentation for global flags/options, is it currently missing?
I'm not fond of the duplication between wezterm/wezterm-gui/wezterm-mux-server.. But this is a larger problem I think, it shouldn't be solved in this PR.
For the implementation
I extracted the existing config load logic to a function that takes a Path, and make it used when the flag is given.
I changed the signature of
reload
(to avoid havingreload()
andreload_from_path(path)
functions), to take aConfigFileSelection
(not sure about the naming), to choose between searching the config file or using a given one.