start clone get info folder

This commit is contained in:
grimhilt
2023-06-04 18:12:47 +02:00
parent 0817e01bdf
commit f398347856
4 changed files with 46 additions and 0 deletions

28
src/commands/clone.rs Normal file
View File

@@ -0,0 +1,28 @@
use clap::Values;
use std::fs::{self, DirBuilder};
use std::path::Path;
use crate::services::list_folders::ListFolders;
use std::error::Error;
pub fn clone(remote: Values<'_>) {
let url = remote.clone().next().unwrap();
let path = Path::new(url);
tokio::runtime::Runtime::new().unwrap().block_on(async {
call(url).await
});
//DirBuilder::new()
// .create(path.parent());
}
pub async fn call(url: &str) -> Result<String, Box<dyn Error>> {
let response = ListFolders::new(url).send().await?;
if response.status().is_success() {
let body = response.text().await?;
println!("Response body: {}", body);
} else {
println!("Request failed with status code: {}", response.status());
}
Ok(())
}