<commit_before>/*
 * Copyright 2012 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.jboss.aesh.console.settings;

import org.jboss.aesh.console.AeshContext;
import org.jboss.aesh.console.Config;
import org.jboss.aesh.console.helper.InterruptHook;
import org.jboss.aesh.edit.EditMode;
import org.jboss.aesh.edit.EmacsEditMode;
import org.jboss.aesh.edit.KeyOperationFactory;
import org.jboss.aesh.edit.KeyOperationManager;
import org.jboss.aesh.edit.Mode;
import org.jboss.aesh.edit.ViEditMode;
import org.jboss.aesh.io.FileResource;
import org.jboss.aesh.io.Resource;
import org.jboss.aesh.terminal.POSIXTerminal;
import org.jboss.aesh.terminal.Terminal;
import org.jboss.aesh.terminal.WindowsTerminal;

import java.io.File;
import java.io.InputStream;
import java.io.PrintStream;

/**
 * Settings object that is parsed when Console is initialized.
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
public class SettingsImpl implements Settings {

    private String name;
    private Mode editMode = Mode.EMACS;
    private File historyFile;
    private int historySize = 500;
    private boolean historyDisabled = false;
    private boolean historyPersistent = true;
    private String bellStyle;
    private boolean ansiConsole = true;
    private InputStream inputStream;
    private PrintStream stdOut;
    private PrintStream stdErr;
    private Terminal terminal;
    private boolean readInputrc = true;
    private File inputrc;
    private boolean isLogging = false;
    private String logFile;
    private boolean disableCompletion = false;
    private boolean readAhead = true;
    private QuitHandler quitHandler;
    private KeyOperationManager operationManager = new KeyOperationManager();
    private File aliasFile;
    private boolean aliasEnabled = true;
    private boolean persistAlias = true;
    private InterruptHook interruptHook = null;
    private boolean enableOperatorParser = true;
    private boolean manEnabled = true;
    private AeshContext aeshContext;
    private boolean exportEnabled = true;
    private File exportFile;
    private boolean persistExport = true;
    private boolean exportUsesSystemEnvironment = false;
    private Resource resource;

    protected SettingsImpl() {
    }

    protected SettingsImpl(Settings baseSettings) {
        setName(baseSettings.getName());
        setMode(baseSettings.getMode());
        setHistoryFile(baseSettings.getHistoryFile());
        setHistorySize(baseSettings.getHistorySize());
        setBellStyle(baseSettings.getBellStyle());
        setAnsiConsole(baseSettings.isAnsiConsole());
        setInputStream(baseSettings.getInputStream());
        setStdOut(baseSettings.getStdOut());
        setStdErr(baseSettings.getStdErr());
        setTerminal(baseSettings.getTerminal());
        setInputrc(baseSettings.getInputrc());
        setLogging(baseSettings.isLogging());
        setDisableCompletion(baseSettings.isDisableCompletion());
        setLogFile(baseSettings.getLogFile());
        setReadInputrc(baseSettings.doReadInputrc());
        setHistoryDisabled(baseSettings.isHistoryDisabled());
        setHistoryPersistent(baseSettings.isHistoryPersistent());
        setReadAhead(baseSettings.isReadAhead());
        setAliasFile(baseSettings.getAliasFile());
        setAliasEnabled(baseSettings.isAliasEnabled());
        setPersistAlias(baseSettings.doPersistAlias());
        setQuitHandler(baseSettings.getQuitHandler());
        setInterruptHook(baseSettings.getInterruptHook());
        enableOperatorParser(baseSettings.isOperatorParserEnabled());
        setManEnabled(baseSettings.isManEnabled());
        setAeshContext(baseSettings.getAeshContext());
        setExportEnabled(baseSettings.isExportEnabled());
        setExportFile(baseSettings.getExportFile());
        setPersistExport(baseSettings.doPersistExport());
        setResource(baseSettings.getResource());
    }

    public void resetToDefaults() {
        setName("aesh");
        editMode = Mode.EMACS;
        historyFile = null;
        historySize = 500;
        historyDisabled = false;
        historyPersistent = true;
        bellStyle = null;
        ansiConsole = true;
        inputStream = null;
        setStdOut(null);
        setStdErr(null);
        terminal = null;
        readInputrc = true;
        isLogging = false;
        logFile = null;
        disableCompletion = false;
        setQuitHandler(null);
        operationManager.clear();
        setAliasEnabled(true);
    }

    /**
     * Set the name of the cli<commit_msg>[AESH-260] Not load System.getenv() on forge.<commit_after>/*
 * Copyright 2012 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.jboss.aesh.console.settings;

import org.jboss.aesh.console.AeshContext;
import org.jboss.aesh.console.Config;
import org.jboss.aesh.console.helper.InterruptHook;
import org.jboss.aesh.edit.EditMode;
import org.jboss.aesh.edit.EmacsEditMode;
import org.jboss.aesh.edit.KeyOperationFactory;
import org.jboss.aesh.edit.KeyOperationManager;
import org.jboss.aesh.edit.Mode;
import org.jboss.aesh.edit.ViEditMode;
import org.jboss.aesh.io.FileResource;
import org.jboss.aesh.io.Resource;
import org.jboss.aesh.terminal.POSIXTerminal;
import org.jboss.aesh.terminal.Terminal;
import org.jboss.aesh.terminal.WindowsTerminal;

import java.io.File;
import java.io.InputStream;
import java.io.PrintStream;

/**
 * Settings object that is parsed when Console is initialized.
 *
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
public class SettingsImpl implements Settings {

    private String name;
    private Mode editMode = Mode.EMACS;
    private File historyFile;
    private int historySize = 500;
    private boolean historyDisabled = false;
    private boolean historyPersistent = true;
    private String bellStyle;
    private boolean ansiConsole = true;
    private InputStream inputStream;
    private PrintStream stdOut;
    private PrintStream stdErr;
    private Terminal terminal;
    private boolean readInputrc = true;
    private File inputrc;
    private boolean isLogging = false;
    private String logFile;
    private boolean disableCompletion = false;
    private boolean readAhead = true;
    private QuitHandler quitHandler;
    private KeyOperationManager operationManager = new KeyOperationManager();
    private File aliasFile;
    private boolean aliasEnabled = true;
    private boolean persistAlias = true;
    private InterruptHook interruptHook = null;
    private boolean enableOperatorParser = true;
    private boolean manEnabled = true;
    private AeshContext aeshContext;
    private boolean exportEnabled = true;
    private File exportFile;
    private boolean persistExport = true;
    private boolean exportUsesSystemEnvironment = false;
    private Resource resource;

    protected SettingsImpl() {
    }

    protected SettingsImpl(Settings baseSettings) {
        setName(baseSettings.getName());
        setMode(baseSettings.getMode());
        setHistoryFile(baseSettings.getHistoryFile());
        setHistorySize(baseSettings.getHistorySize());
        setBellStyle(baseSettings.getBellStyle());
        setAnsiConsole(baseSettings.isAnsiConsole());
        setInputStream(baseSettings.getInputStream());
        setStdOut(baseSettings.getStdOut());
        setStdErr(baseSettings.getStdErr());
        setTerminal(baseSettings.getTerminal());
        setInputrc(baseSettings.getInputrc());
        setLogging(baseSettings.isLogging());
        setDisableCompletion(baseSettings.isDisableCompletion());
        setLogFile(baseSettings.getLogFile());
        setReadInputrc(baseSettings.doReadInputrc());
        setHistoryDisabled(baseSettings.isHistoryDisabled());
        setHistoryPersistent(baseSettings.isHistoryPersistent());
        setReadAhead(baseSettings.isReadAhead());
        setAliasFile(baseSettings.getAliasFile());
        setAliasEnabled(baseSettings.isAliasEnabled());
        setPersistAlias(baseSettings.doPersistAlias());
        setQuitHandler(baseSettings.getQuitHandler());
        setInterruptHook(baseSettings.getInterruptHook());
        enableOperatorParser(baseSettings.isOperatorParserEnabled());
        setManEnabled(baseSettings.isManEnabled());
        setAeshContext(baseSettings.getAeshContext());
        setExportEnabled(baseSettings.isExportEnabled());
        setExportFile(baseSettings.getExportFile());
        setPersistExport(baseSettings.doPersistExport());
        setResource(baseSettings.getResource());
        setExportUsesSystemEnvironment(baseSettings.doExportUsesSystemEnvironment());
    }

    public void resetToDefaults() {
        setName("aesh");
        editMode = Mode.EMACS;
        historyFile = null;
        historySize = 500;
        historyDisabled = false;
        historyPersistent = true;
        bellStyle = null;
        ansiConsole = true;
        inputStream = null;
        setStdOut(null);
        setStdErr(null);
        terminal = null;
        readInputrc = true;
        isLogging = false;
        logFile = null;
        disableCompletion = false;
        setQuitHandler(null);
        operationManager.clear();
        setAliasEnabled(true);
    }

    /**
     * Set the name of the cli
{'fraction_non_alphanumeric': 0.09308002547229888, 'fraction_numerical': 0.003290171938017406, 'mean_word_length': 3.65793376173999, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7249077', 'n_tokens_mistral': 2622, 'n_tokens_neox': 2525, 'n_words': 533}