fixed a bug on new project creation where the config file path wasn't
being passed correctly. Also started the groundwork for adding more of my rust based tooling to tetanus.
This commit is contained in:
+56
-4
@@ -49,6 +49,7 @@ pub fn startup(
|
||||
let response = get_user_input("which config would you like to load?")?;
|
||||
if let Some(path) = selections.get(&response) {
|
||||
app.load_config(PathBuf::from(path), true)?;
|
||||
println!("entering tui...");
|
||||
run_tui(app, rx, handles.clone())?;
|
||||
} else {
|
||||
eprintln!("error invalid selection! exiting...");
|
||||
@@ -56,11 +57,13 @@ pub fn startup(
|
||||
}
|
||||
} else {
|
||||
app.load_config(state.config_file.clone(), true)?;
|
||||
println!("entering tui...");
|
||||
run_tui(app, rx, handles.clone())?;
|
||||
}
|
||||
if nested {
|
||||
let (tx, rx) = channel();
|
||||
state.main_tx = tx;
|
||||
println!("returning to prevous tui...");
|
||||
run_tui(state, rx, handles.clone())?;
|
||||
}
|
||||
Ok(())
|
||||
@@ -475,6 +478,35 @@ pub fn run_tui(
|
||||
);
|
||||
}
|
||||
"CMD" => {
|
||||
if let Some((cmd, data)) =
|
||||
data.split_once("|")
|
||||
{
|
||||
match cmd.trim() {
|
||||
"SET_NAME" => {
|
||||
locked_server
|
||||
.name = data
|
||||
.trim()
|
||||
.to_string();
|
||||
}
|
||||
"LIST_PROJECTS" => {
|
||||
let _ = ToolMessage::Input((locked_server.client_id.clone(), "list_projects".to_string()));
|
||||
}
|
||||
_ => {
|
||||
let msg = format!(
|
||||
"MSG FROM: {}",
|
||||
data.trim()
|
||||
);
|
||||
let _ = tx_clone.send(
|
||||
ToolMessage::Output((
|
||||
locked_server
|
||||
.client_id
|
||||
.clone(),
|
||||
msg,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if data.contains("SET_NAME") {
|
||||
if let Some((_, name)) =
|
||||
data.split_once("|")
|
||||
@@ -485,7 +517,7 @@ pub fn run_tui(
|
||||
}
|
||||
} else {
|
||||
let _ = tx_clone.send(
|
||||
ToolMessage::Input((
|
||||
ToolMessage::Output((
|
||||
locked_server
|
||||
.client_id
|
||||
.clone(),
|
||||
@@ -680,13 +712,33 @@ pub fn run_tui(
|
||||
}
|
||||
} else {
|
||||
if args == "" {
|
||||
let _ = state.execute_command(command, None, 0);
|
||||
match state.execute_command(command, None, 0) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
let _ = state.main_tx.send(
|
||||
ToolMessage::Output((
|
||||
0,
|
||||
e.to_string(),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let _ = state.execute_command(
|
||||
match state.execute_command(
|
||||
command,
|
||||
Some(args.to_string()),
|
||||
0,
|
||||
);
|
||||
) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
let _ = state.main_tx.send(
|
||||
ToolMessage::Output((
|
||||
0,
|
||||
e.to_string(),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user