use web_sys::FileReader;
use crate::loadar2;
use crate::rendering::render;
use crate::scope::ScopeState;

pub fn should_newline(state: &mut ScopeState) -> bool {
    state.command_buf.starts_with("SET MODE")
}

pub fn exec(state: &mut ScopeState, command: String) {
    if command == "CLF OV" {
        state.file_input.click();
    } else if command == "CLF RELOAD" {
        state.command_buf = "SYSTEM PROCESSING".to_string();
        state.command_buf_response_mode = true;
        render(state).expect("rerender failed");
        loadar2("file");
    } else {
        state.command_buf = "UNRECOGNIZED COMMAND".to_string();
        state.command_buf_response_mode = true;
    }
}