mirror of https://github.com/tstack/lnav.git
[config] include values from the configs dir in the default config
This commit is contained in:
parent
ce8397b5cf
commit
e33fe1a85b
3
NEWS
3
NEWS
|
@ -3,6 +3,9 @@ lnav v0.10.1:
|
|||
* The text "send-input" would show up on some terminals instead of
|
||||
ignoring the escape sequence. This control sequence was only
|
||||
intended to be used in the test suite.
|
||||
* Configuration values loaded from the ~/.lnav/configs directory
|
||||
are now included in the default configuration, so they won't be
|
||||
saved into the ~/.lnav/config.json user configuration file.
|
||||
|
||||
lnav v0.10.0:
|
||||
Features:
|
||||
|
|
|
@ -1075,14 +1075,14 @@ detect_config_file_type(const ghc::filesystem::path &path)
|
|||
}
|
||||
}
|
||||
|
||||
static void load_config_from(const ghc::filesystem::path &path, vector<string> &errors)
|
||||
static void load_config_from(_lnav_config& lconfig, const ghc::filesystem::path &path, vector<string> &errors)
|
||||
{
|
||||
yajlpp_parse_context ypc(path.string(), &lnav_config_handlers);
|
||||
struct userdata ud(errors);
|
||||
auto_fd fd;
|
||||
|
||||
ypc.ypc_locations = &lnav_config_locations;
|
||||
ypc.with_obj(lnav_config);
|
||||
ypc.with_obj(lconfig);
|
||||
ypc.ypc_userdata = &ud;
|
||||
ypc.with_error_reporter(config_error_reporter);
|
||||
if ((fd = openp(path, O_RDONLY)) == -1) {
|
||||
|
@ -1194,7 +1194,10 @@ void load_config(const vector<ghc::filesystem::path> &extra_paths, vector<string
|
|||
|
||||
if (glob(config_path.c_str(), 0, nullptr, gl.inout()) == 0) {
|
||||
for (size_t lpc = 0; lpc < gl->gl_pathc; lpc++) {
|
||||
load_config_from(gl->gl_pathv[lpc], errors);
|
||||
load_config_from(lnav_config, gl->gl_pathv[lpc], errors);
|
||||
if (errors.empty()) {
|
||||
load_config_from(lnav_default_config, gl->gl_pathv[lpc], errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1204,12 +1207,15 @@ void load_config(const vector<ghc::filesystem::path> &extra_paths, vector<string
|
|||
|
||||
if (glob(config_path.c_str(), 0, nullptr, gl.inout()) == 0) {
|
||||
for (size_t lpc = 0; lpc < gl->gl_pathc; lpc++) {
|
||||
load_config_from(gl->gl_pathv[lpc], errors);
|
||||
load_config_from(lnav_config, gl->gl_pathv[lpc], errors);
|
||||
if (errors.empty()) {
|
||||
load_config_from(lnav_default_config, gl->gl_pathv[lpc], errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
load_config_from(user_config, errors);
|
||||
load_config_from(lnav_config, user_config, errors);
|
||||
}
|
||||
|
||||
reload_config(errors);
|
||||
|
|
Loading…
Reference in New Issue