storages.yml check

This commit is contained in:
qwjyh 2023-12-08 03:25:15 +09:00
parent 5f81eccd2d
commit 2f9fa08cf2

View file

@ -326,19 +326,25 @@ fn main() -> Result<()> {
} }
println!("The name {} is already used.", name); println!("The name {} is already used.", name);
} }
let provider = Text::new("Provider:").prompt().context("Failed to get provider")?; let provider = Text::new("Provider:")
.prompt()
.context("Failed to get provider")?;
let capacity: u64 = CustomType::<u64>::new("Capacity (byte):") let capacity: u64 = CustomType::<u64>::new("Capacity (byte):")
.with_error_message("Please type number.") .with_error_message("Please type number.")
.prompt() .prompt()
.context("Failed to get capacity.")?; .context("Failed to get capacity.")?;
let alias = Text::new("Alias:").prompt().context("Failed to get provider")?; let alias = Text::new("Alias:")
.prompt()
.context("Failed to get provider")?;
let storage = OnlineStorage::new( let storage = OnlineStorage::new(
name.clone(), provider, capacity, alias, path, &device, name.clone(),
); provider,
( capacity,
name, alias,
Storage::Online(storage), path,
) &device,
);
(name, Storage::Online(storage))
} }
}; };
@ -418,7 +424,11 @@ fn main() -> Result<()> {
Commands::Sync {} => { Commands::Sync {} => {
unimplemented!("Sync is not implemented") unimplemented!("Sync is not implemented")
} }
Commands::Check {} => todo!(), Commands::Check {} => {
println!("Config dir: {}", &config_dir.display());
let _storages = storages::get_storages(&config_dir).context("Failed to parse storages file.");
todo!()
},
} }
full_status(&Repository::open(&config_dir)?)?; full_status(&Repository::open(&config_dir)?)?;
Ok(()) Ok(())