<commit_before>package org.metaborg.spoofax.shell.client;

import java.io.InputStream;
import java.io.OutputStream;

import org.metaborg.spoofax.shell.ReplModule;
import org.metaborg.spoofax.shell.client.console.commands.ExitCommand;
import org.metaborg.spoofax.shell.client.console.impl.ConsoleRepl;
import org.metaborg.spoofax.shell.client.console.impl.TerminalUserInterface;
import org.metaborg.spoofax.shell.client.console.impl.history.JLine2InputHistory;
import org.metaborg.spoofax.shell.client.console.impl.history.JLine2PersistentInputHistory;
import org.metaborg.spoofax.shell.commands.IReplCommand;

import com.google.inject.Singleton;
import com.google.inject.multibindings.MapBinder;
import com.google.inject.name.Names;

/**
 * Bindings for the console REPL.
 */
public class ConsoleReplModule extends ReplModule {

    @Override
    protected void bindCommands(MapBinder<String, IReplCommand> commandBinder) {
        super.bindCommands(commandBinder);
        commandBinder.addBinding("exit").to(ExitCommand.class).in(Singleton.class);
    }

    /**
     * Binds the user interface implementations.
     */
    protected void bindUserInterface() {
        bind(IRepl.class).to(ConsoleRepl.class);
        bind(ConsoleRepl.class).in(Singleton.class);
        bind(IInputHistory.class).to(JLine2InputHistory.class);
        bind(JLine2InputHistory.class).to(JLine2PersistentInputHistory.class);

        bind(TerminalUserInterface.class).in(Singleton.class);
        bind(IDisplay.class).to(TerminalUserInterface.class);

        bind(InputStream.class).annotatedWith(Names.named("in")).toInstance(System.in);
        bind(OutputStream.class).annotatedWith(Names.named("out")).toInstance(System.out);
        bind(OutputStream.class).annotatedWith(Names.named("err")).toInstance(System.err);

        bindConstant().annotatedWith(Names.named("historyPath"))
            .to(System.getProperty("user.home") + "/.spoofax_history");
    }

    @Override
    protected void configure() {
        super.configure();
        bindUserInterface();
    }
}<commit_msg>Fix persistent inputhistory.<commit_after>package org.metaborg.spoofax.shell.client;

import java.io.InputStream;
import java.io.OutputStream;

import org.metaborg.spoofax.shell.ReplModule;
import org.metaborg.spoofax.shell.client.console.commands.ExitCommand;
import org.metaborg.spoofax.shell.client.console.impl.ConsoleRepl;
import org.metaborg.spoofax.shell.client.console.impl.TerminalUserInterface;
import org.metaborg.spoofax.shell.client.console.impl.history.JLine2InputHistory;
import org.metaborg.spoofax.shell.client.console.impl.history.JLine2PersistentInputHistory;
import org.metaborg.spoofax.shell.commands.IReplCommand;

import com.google.inject.Singleton;
import com.google.inject.multibindings.MapBinder;
import com.google.inject.name.Names;

import jline.console.ConsoleReader;

/**
 * Bindings for the console REPL.
 */
public class ConsoleReplModule extends ReplModule {

    @Override
    protected void bindCommands(MapBinder<String, IReplCommand> commandBinder) {
        super.bindCommands(commandBinder);
        commandBinder.addBinding("exit").to(ExitCommand.class).in(Singleton.class);
    }

    /**
     * Binds the user interface implementations.
     */
    protected void bindUserInterface() {
        bind(IRepl.class).to(ConsoleRepl.class);
        bind(ConsoleRepl.class).in(Singleton.class);
        bind(ConsoleReader.class).in(Singleton.class);
        bind(IInputHistory.class).to(JLine2InputHistory.class);
        bind(JLine2InputHistory.class).to(JLine2PersistentInputHistory.class);

        bind(TerminalUserInterface.class).in(Singleton.class);
        bind(IDisplay.class).to(TerminalUserInterface.class);

        bind(InputStream.class).annotatedWith(Names.named("in")).toInstance(System.in);
        bind(OutputStream.class).annotatedWith(Names.named("out")).toInstance(System.out);
        bind(OutputStream.class).annotatedWith(Names.named("err")).toInstance(System.err);

        bindConstant().annotatedWith(Names.named("historyPath"))
            .to(System.getProperty("user.home") + "/.spoofax_history");
    }

    @Override
    protected void configure() {
        super.configure();
        bindUserInterface();
    }
}
{'fraction_non_alphanumeric': 0.1250881730543146, 'fraction_numerical': 0.0023512814483893723, 'mean_word_length': 4.391634980988593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1379575', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1303, 'n_words': 145}