<commit_before>import Base: LineEdit, REPL, Terminals

import Base.LineEdit: CompletionProvider
import Base.REPL: LineEditREPL, BasicREPL, StreamREPL, ends_with_semicolon, print_response
import Base.REPLCompletions: bslash_completions, non_identifier_chars, should_method_complete,
find_start_brace, complete_path

import Base: TTY

import Base.Terminals
import Base.REPL

import Base: active_repl

import Base: text_colors, possible_formatting_symbols, available_text_colors, available_text_colors_docstring,
have_color, default_color_warn, default_color_info, default_color_input,  default_color_answer,
color_normal, repl_color, warn_color, info_color, input_color, answer_color, repl_cmd,
display_error, eval_user_input, syntax_deprecation_warnings, parse_input_line, incomplete_tag,
try_include, process_options, load_machine_file, repl_hooks,
atreplinit, _atreplinit

##################################################

# See base/client.jl


function SJulia_start()
    opts = Base.JLOptions()    
    startup               = (opts.startupfile != 2)
    history_file          = (opts.historyfile != 0)
    quiet                 = (opts.quiet != 0)

    color_set             = (opts.color != 0)
    global have_color     = (opts.color == 1)

    local term
    global active_repl
    global active_repl_backend

#    repl = true
    
    if !isa(STDIN,TTY)
        global is_interactive |= !isa(STDIN,Union{File,IOStream})
        color_set || (global have_color = false)
    else
        term = Terminals.TTYTerminal(get(ENV,"TERM",@windows? "" : "dumb"),STDIN,STDOUT,STDERR)
        global is_interactive = true
        color_set || (global have_color = Terminals.hascolor(term))
        quiet || REPL.banner(term,term)
        if term.term_type == "dumb"
            active_repl = REPL.BasicREPL(term)
            quiet || warn("Terminal not fully functional")
        else
            active_repl = REPL.LineEditREPL(term, true)
            active_repl.history_file = history_file
            active_repl.hascolor = have_color
        end
        # Make sure any displays pushed in .juliarc.jl ends up above the
                # REPLDisplay
        pushdisplay(REPL.REPLDisplay(active_repl))
    end

    if !isa(STDIN,TTY)
        # note: currently IOStream is used for file STDIN
        if isa(STDIN,File) || isa(STDIN,IOStream)
            # reading from a file, behave like include
            eval(Main,parse_input_line(readstring(STDIN)))
        else
            # otherwise behave repl-like<commit_msg>commit <PASSWORD> Author: <NAME> <<EMAIL>> Date:   Tue Apr 19 23:21:22 2016 +0200<commit_after>import Base: LineEdit, REPL, Terminals

import Base.LineEdit: CompletionProvider
import Base.REPL: LineEditREPL, BasicREPL, StreamREPL, ends_with_semicolon, print_response
import Base.REPLCompletions: bslash_completions, non_identifier_chars, should_method_complete,
find_start_brace, complete_path

import Base: TTY

import Base.Terminals
import Base.REPL

import Base: active_repl

import Base: text_colors, possible_formatting_symbols, available_text_colors, available_text_colors_docstring,
have_color, default_color_warn, default_color_info, default_color_input,  default_color_answer,
color_normal, repl_color, warn_color, info_color, input_color, answer_color, repl_cmd,
display_error, eval_user_input, syntax_deprecation_warnings, parse_input_line, incomplete_tag,
try_include, process_options, load_machine_file, repl_hooks,
atreplinit, _atreplinit

##################################################

# See base/client.jl

function SJulia_start()
    opts = Base.JLOptions()    
    startup               = (opts.startupfile != 2)
    history_file          = (opts.historyfile != 0)
    quiet                 = (opts.quiet != 0)

    color_set             = (opts.color != 0)
    global have_color     = (opts.color == 1)

    local term
    global active_repl
    global active_repl_backend

    if !isa(STDIN,TTY)
        global is_interactive |= !isa(STDIN,Union{File,IOStream})
        color_set || (global have_color = false)
    else
        term = Terminals.TTYTerminal(get(ENV,"TERM",@windows? "" : "dumb"),STDIN,STDOUT,STDERR)
        global is_interactive = true
        color_set || (global have_color = Terminals.hascolor(term))
        quiet || REPL.banner(term,term)
        if term.term_type == "dumb"
            active_repl = REPL.BasicREPL(term)
            quiet || warn("Terminal not fully functional")
        else
            active_repl = REPL.LineEditREPL(term, true)
            active_repl.history_file = history_file
            active_repl.hascolor = have_color
        end
        # Make sure any displays pushed in .juliarc.jl ends up above the
                # REPLDisplay
        pushdisplay(REPL.REPLDisplay(active_repl))
    end

    Base.eval(parse("global have_color = true"))  # get colors for warn and error

    if !isa(STDIN,TTY)
        # note: currently IOStream is used for file STDIN
        if isa(STDIN,File) || isa(STDIN,IOStream)
            # reading from a file, behave like include
            eval(Main,parse_input_line(readstring(STDIN)))
        else
            # otherwise behave repl-like
{'fraction_non_alphanumeric': 0.10166215693853885, 'fraction_numerical': 0.005025125628140704, 'mean_word_length': 3.3233082706766917, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3997138', 'n_tokens_mistral': 1641, 'n_tokens_neox': 1580, 'n_words': 359}