111 lines
No EOL
3.5 KiB
Rust
111 lines
No EOL
3.5 KiB
Rust
mod cli;
|
|
|
|
use clap::Parser;
|
|
|
|
use crate::cli::commands::{Cli, Commands};
|
|
use crate::cli::interface::CliInterface;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let cli = Cli::parse();
|
|
let interface = CliInterface::new();
|
|
|
|
match cli.command {
|
|
Commands::Create { universe, output } => {
|
|
interface.handle_create(&universe, &output)?;
|
|
}
|
|
Commands::CreateUniverse { name } => {
|
|
interface.handle_create_universe(&name)?;
|
|
}
|
|
Commands::ImportRecovery { universe, output } => {
|
|
interface.handle_import_recovery(&universe, &output)?;
|
|
}
|
|
Commands::ImportFile { input, output } => {
|
|
interface.handle_import_file(&input, output.as_deref())?;
|
|
}
|
|
Commands::Export { input, output } => {
|
|
interface.handle_export(&input, &output)?;
|
|
}
|
|
Commands::Info { file } => {
|
|
interface.handle_info(&file)?;
|
|
}
|
|
Commands::Sign { file, message } => {
|
|
interface.handle_sign(&file, &message)?;
|
|
}
|
|
Commands::Profile { command } => {
|
|
match command {
|
|
crate::cli::commands::ProfileCommands::List { file } => {
|
|
interface.handle_profile_list(&file)?;
|
|
}
|
|
crate::cli::commands::ProfileCommands::Create {
|
|
file,
|
|
hub_did,
|
|
handle,
|
|
display_name,
|
|
first_name,
|
|
last_name,
|
|
email,
|
|
avatar_url,
|
|
bio,
|
|
theme,
|
|
language,
|
|
notifications,
|
|
auto_sync,
|
|
} => {
|
|
interface.handle_profile_create(
|
|
&file,
|
|
hub_did,
|
|
handle,
|
|
display_name,
|
|
first_name,
|
|
last_name,
|
|
email,
|
|
avatar_url,
|
|
bio,
|
|
theme,
|
|
language,
|
|
notifications,
|
|
auto_sync,
|
|
)?;
|
|
}
|
|
crate::cli::commands::ProfileCommands::Update {
|
|
file,
|
|
id,
|
|
hub_did,
|
|
handle,
|
|
display_name,
|
|
first_name,
|
|
last_name,
|
|
email,
|
|
avatar_url,
|
|
bio,
|
|
theme,
|
|
language,
|
|
notifications,
|
|
auto_sync,
|
|
} => {
|
|
interface.handle_profile_update(
|
|
&file,
|
|
&id,
|
|
hub_did,
|
|
handle,
|
|
display_name,
|
|
first_name,
|
|
last_name,
|
|
email,
|
|
avatar_url,
|
|
bio,
|
|
theme,
|
|
language,
|
|
notifications,
|
|
auto_sync,
|
|
)?;
|
|
}
|
|
crate::cli::commands::ProfileCommands::Delete { file, id } => {
|
|
interface.handle_profile_delete(&file, &id)?;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
} |