mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-04 00:58:46 +00:00
feature flags: add the notion of a default value for each flag
This commit is contained in:
parent
053acf5c6b
commit
2e44076397
2 changed files with 12 additions and 4 deletions
|
@ -6,15 +6,20 @@
|
||||||
|
|
||||||
#include "wcstringutil.h"
|
#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.
|
/// The set of features applying to this instance.
|
||||||
features_t features_t::global_features;
|
features_t features_t::global_features;
|
||||||
|
|
||||||
const features_t::metadata_t features_t::metadata[features_t::flag_count] = {
|
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"},
|
{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"},
|
{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"},
|
{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) {
|
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.
|
/// User-presentable description of the feature flag.
|
||||||
const wchar_t *description;
|
const wchar_t *description;
|
||||||
|
|
||||||
|
/// Default flag value.
|
||||||
|
const bool default_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The metadata, indexed by flag.
|
/// The metadata, indexed by flag.
|
||||||
|
|
Loading…
Reference in a new issue