added distrobox logic, and protomotion logic
This commit is contained in:
+14
-2
@@ -35,6 +35,11 @@ pub fn run_tui(
|
||||
let mut terminal = Terminal::new(backend)?;
|
||||
let (event_tx, event_rx) = channel::<AppEvent>();
|
||||
let input_tx = event_tx.clone();
|
||||
let mut project_list_state = ListState::default();
|
||||
if !state.projects.is_empty() {
|
||||
project_list_state.select(Some(0));
|
||||
state.selected_project = 0;
|
||||
}
|
||||
std::thread::spawn(move || {
|
||||
loop {
|
||||
if event::poll(Duration::from_millis(100)).unwrap_or(false) {
|
||||
@@ -169,6 +174,9 @@ pub fn run_tui(
|
||||
state.output.push("Error: USAGE -> np <org> <name>".into());
|
||||
}
|
||||
}
|
||||
"current_project" | "cp" => {
|
||||
let _ = state.execute_command(command, None);
|
||||
}
|
||||
command_name => {
|
||||
if state.module_loader.commands.contains_key(command_name) {
|
||||
state.output.push(format!(
|
||||
@@ -221,7 +229,9 @@ pub fn run_tui(
|
||||
{
|
||||
if let Some(selected) = project_list_state.selected() {
|
||||
if selected > 0 {
|
||||
project_list_state.select(Some(selected - 1));
|
||||
let new_index = selected - 1;
|
||||
project_list_state.select(Some(new_index));
|
||||
state.selected_project = new_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,7 +242,9 @@ pub fn run_tui(
|
||||
{
|
||||
if let Some(selected) = project_list_state.selected() {
|
||||
if selected + 1 < state.projects.len() {
|
||||
project_list_state.select(Some(selected + 1));
|
||||
let new_index = selected + 1;
|
||||
project_list_state.select(Some(new_index));
|
||||
state.selected_project = new_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user