added a bit of breakup between the startup output and the prompt to
select a config, also made the switch_config command clear the current_input so that it's not left over when you come back.
This commit is contained in:
@@ -33,6 +33,7 @@ pub fn startup(
|
|||||||
app.main_tx = tx.clone();
|
app.main_tx = tx.clone();
|
||||||
if let Some(line) = state.config.get("alternate_configs") {
|
if let Some(line) = state.config.get("alternate_configs") {
|
||||||
let mut selections = HashMap::new();
|
let mut selections = HashMap::new();
|
||||||
|
println!("\n");
|
||||||
line.split(",").into_iter().for_each(|line| {
|
line.split(",").into_iter().for_each(|line| {
|
||||||
if let Some((name, path)) = line.split_once("|") {
|
if let Some((name, path)) = line.split_once("|") {
|
||||||
selections.insert(name.to_string(), path.to_string());
|
selections.insert(name.to_string(), path.to_string());
|
||||||
@@ -44,6 +45,7 @@ pub fn startup(
|
|||||||
state.config_file.display().to_string(),
|
state.config_file.display().to_string(),
|
||||||
);
|
);
|
||||||
println!("default | {}", state.config_file.display());
|
println!("default | {}", state.config_file.display());
|
||||||
|
println!("\n");
|
||||||
let response = get_user_input("which config would you like to load?")?;
|
let response = get_user_input("which config would you like to load?")?;
|
||||||
if let Some(path) = selections.get(&response) {
|
if let Some(path) = selections.get(&response) {
|
||||||
app.load_config(PathBuf::from(path), true)?;
|
app.load_config(PathBuf::from(path), true)?;
|
||||||
@@ -653,6 +655,7 @@ pub fn run_tui(
|
|||||||
}
|
}
|
||||||
"switch_config" => {
|
"switch_config" => {
|
||||||
switch_config = true;
|
switch_config = true;
|
||||||
|
state.curent_intput.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
command_name => {
|
command_name => {
|
||||||
|
|||||||
+2
-2
@@ -141,7 +141,7 @@ async fn main() {
|
|||||||
);
|
);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
let (mut appstate) = AppState::new();
|
let mut appstate = AppState::new();
|
||||||
let config_load = appstate.load_config(client_config_path.clone(), true);
|
let config_load = appstate.load_config(client_config_path.clone(), true);
|
||||||
if config_load.is_err() {
|
if config_load.is_err() {
|
||||||
eprintln!("error loading config!");
|
eprintln!("error loading config!");
|
||||||
@@ -153,8 +153,8 @@ async fn main() {
|
|||||||
});
|
});
|
||||||
let handles = Arc::new(Mutex::new(Vec::new()));
|
let handles = Arc::new(Mutex::new(Vec::new()));
|
||||||
let handles_clone = handles.clone();
|
let handles_clone = handles.clone();
|
||||||
println!("entering tui...");
|
|
||||||
let primary_handle = spawn(move || {
|
let primary_handle = spawn(move || {
|
||||||
|
println!("entering tui...");
|
||||||
let _ = startup(appstate, false, handles_clone);
|
let _ = startup(appstate, false, handles_clone);
|
||||||
});
|
});
|
||||||
if let Ok(mut lock) = handles.lock() {
|
if let Ok(mut lock) = handles.lock() {
|
||||||
|
|||||||
Reference in New Issue
Block a user