Teach fish_indent about our feature flags

So it can handle syntax changes that call for different formatting.
This commit is contained in:
Johannes Altmanninger
2021-07-10 20:08:34 +02:00
parent cc32b4f2a7
commit a2b30053dc
2 changed files with 11 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "fds.h"
#include "fish_version.h"
#include "flog.h"
#include "future_feature_flags.h"
#include "highlight.h"
#include "operation_context.h"
#include "output.h"
@@ -853,6 +854,12 @@ int main(int argc, char *argv[]) {
setlocale(LC_ALL, "");
env_init();
if (auto features_var = env_stack_t::globals().get(L"fish_features")) {
for (const wcstring &s : features_var->as_list()) {
mutable_fish_features().set_from_string(s);
}
}
// Types of output we support.
enum {
output_type_plain_text,

View File

@@ -1,4 +1,4 @@
#RUN: %fish --features=ampersand-nobg-in-token %s
#RUN: %fish --features=ampersand-nobg-in-token -C 'set -g fish_indent %fish_indent' %s
echo no&background
# CHECK: no&background
@@ -10,3 +10,6 @@ echo background &
# CHECK: background
wait
echo no&bg | fish_features=ampersand-nobg-in-token $fish_indent --check
echo $status #CHECK: 0