1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 21:06:38 +02:00

fset: add filters "d=" and "d=="

This commit is contained in:
Sébastien Helleu
2017-05-29 22:32:07 +02:00
parent 4c65f2b648
commit 7df98862d6
2 changed files with 28 additions and 7 deletions
+10 -7
View File
@@ -284,12 +284,15 @@ fset_command_init ()
"of option (move the cursor at the end of value)\n"
" filter: set a new filter to see only matching options; allowed "
"formats are:\n"
" f:xxx show only configuration file \"xxx\"\n"
" s:xxx show only section \"xxx\"\n"
" d: show only changed options\n"
" d:xxx show only changed options with \"xxx\" in name\n"
" =xxx show only options with \"xxx\" in value\n"
" ==xxx show only options with value \"xxx\""),
" * show all options (no filter)\n"
" f:xxx show only configuration file \"xxx\"\n"
" s:xxx show only section \"xxx\"\n"
" d: show only changed options\n"
" d:xxx show only changed options with \"xxx\" in name\n"
" d=xxx show only changed options with \"xxx\" in value\n"
" d==xxx show only changed options with exact value \"xxx\"\n"
" =xxx show only options with \"xxx\" in value\n"
" ==xxx show only options with exact value \"xxx\""),
"-bar"
" || -refresh"
" || -up 1|2|3|4|5"
@@ -301,6 +304,6 @@ fset_command_init ()
" || -unset"
" || -set"
" || -append"
" || f:|s:|d:|=|==",
" || *|f:|s:|d:|d=|d==|=|==",
&fset_command_fset, NULL, NULL);
}
+18
View File
@@ -199,6 +199,24 @@ fset_option_match_filters (const char *config_name, const char *section_name,
/* filter by section name */
return (weechat_strcasecmp (section_name, fset_option_filter + 2) == 0) ? 1 : 0;
}
else if (strncmp (fset_option_filter, "d==", 3) == 0)
{
/* filter by modified values, exact value */
if (!fset_option_value_different_from_default (fset_option))
return 0;
return (weechat_strcasecmp (
(fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL,
fset_option_filter + 3) == 0) ? 1 : 0;
}
else if (strncmp (fset_option_filter, "d=", 2) == 0)
{
/* filter by modified values, value */
if (!fset_option_value_different_from_default (fset_option))
return 0;
return (weechat_strcasestr (
(fset_option->value) ? fset_option->value : FSET_OPTION_VALUE_NULL,
fset_option_filter + 2)) ? 1 : 0;
}
else if (strncmp (fset_option_filter, "d:", 2) == 0)
{
/* filter by modified values */