mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:26:33 +08:00
feature flags: add the notion of a default value for each flag
This commit is contained in:
parent
053acf5c6b
commit
2e44076397
|
@ -6,15 +6,20 @@
|
|||
|
||||
#include "wcstringutil.h"
|
||||
|
||||
features_t::features_t() = default;
|
||||
features_t::features_t() {
|
||||
for (const metadata_t &md : metadata) {
|
||||
this->set(md.flag, md.default_value);
|
||||
}
|
||||
}
|
||||
|
||||
/// The set of features applying to this instance.
|
||||
features_t features_t::global_features;
|
||||
|
||||
const features_t::metadata_t features_t::metadata[features_t::flag_count] = {
|
||||
{stderr_nocaret, L"stderr-nocaret", L"3.0", L"^ no longer redirects stderr"},
|
||||
{qmark_noglob, L"qmark-noglob", L"3.0", L"? no longer globs"},
|
||||
{string_replace_backslash, L"regex-easyesc", L"3.1", L"string replace -r needs fewer \\'s"},
|
||||
{stderr_nocaret, L"stderr-nocaret", L"3.0", L"^ no longer redirects stderr", false},
|
||||
{qmark_noglob, L"qmark-noglob", L"3.0", L"? no longer globs", false},
|
||||
{string_replace_backslash, L"regex-easyesc", L"3.1", L"string replace -r needs fewer \\'s",
|
||||
false},
|
||||
};
|
||||
|
||||
const struct features_t::metadata_t *features_t::metadata_for(const wchar_t *name) {
|
||||
|
|
|
@ -57,6 +57,9 @@ class features_t {
|
|||
|
||||
/// User-presentable description of the feature flag.
|
||||
const wchar_t *description;
|
||||
|
||||
/// Default flag value.
|
||||
const bool default_value;
|
||||
};
|
||||
|
||||
/// The metadata, indexed by flag.
|
||||
|
|
Loading…
Reference in New Issue
Block a user