use std::fmt::Display;
use inquire::{MultiSelect, Select};
use inquire_derive::Selectable;
use crate::remote;
#[derive(Debug, Copy, Clone, Selectable)]
pub enum Action {
Clone,
}
impl Display for Action {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self)
}
}
type NamespaceRepos = (String, String);
pub async fn action(action: Option<Action>) {
// todo pass in url
let _remote = remote::tree_from_remote("none");
let selected = Select::new("Repos:", vec!["all,", "namespaces", "repos"])
.prompt()
.unwrap();
// todo let user select
// on all -> do actions on all repos
// on namespaces -> select a namespace, do actions on all repos in namespace
// on repos -> let user select repo and do actions on that repo
match selected {
"all" => {}
"namespace" => {}
"repo" => {}
_ => {}
}
let action = match action {
Some(action) => action,
None => Action::select("Choose an action").prompt().unwrap(),
};
match action {
Action::Clone => {
// clone should create the tree as dirs and clone repos inside each dir
}
}
}