feat: CLI Support for multiple Servarr instances

This commit is contained in:
2025-02-27 20:37:03 -07:00
parent f87e02cd7c
commit fd6fcfc98f
9 changed files with 239 additions and 40 deletions
+33 -1
View File
@@ -303,7 +303,39 @@ impl TabState {
&self.tabs[self.index].config
}
pub fn select_tab_by_title(&mut self, name: &str) -> bool {
if !self.tabs.is_empty() {
let mut found = false;
self.tabs.iter().enumerate().for_each(|(idx, tab)| {
if tab.title == name {
self.index = idx;
found = true;
}
});
return found;
}
false
}
pub fn select_tab_by_config(&mut self, config: &ServarrConfig) -> bool {
if !self.tabs.is_empty() {
let mut found = false;
self.tabs.iter().enumerate().for_each(|(idx, tab)| {
if tab.config == Some(config.clone()) {
self.index = idx;
found = true;
}
});
return found;
}
false
}
pub fn get_active_tab_help(&self) -> &str {
&self.tabs[self.index].help
}