progress-pile/dpts-cli/src/main.rs

43 lines
815 B
Rust
Raw Normal View History

2025-04-24 09:26:24 +09:00
//mod label;
2025-05-06 22:15:29 +09:00
mod init;
2025-04-24 09:26:24 +09:00
mod record;
2025-05-08 06:33:08 +09:00
mod user;
2025-04-24 09:26:24 +09:00
2025-05-08 06:33:08 +09:00
pub use dpts_client::error;
2025-05-04 11:10:14 +09:00
2025-05-06 22:15:29 +09:00
2025-04-24 09:26:24 +09:00
//use label::LabelArgs;
use record::{RecordArgs,RecordAddArgs};
2025-05-04 11:10:14 +09:00
use error::Error;
2025-05-06 22:15:29 +09:00
use init::InitArgs;
2025-04-27 08:36:57 +09:00
use clap::{Args, CommandFactory, Parser, Subcommand};
use std::ffi::OsString;
2025-04-24 09:26:24 +09:00
#[derive(Parser)]
#[command(version, about, long_about = None)]
#[command(propagate_version=true)]
struct Cli {
#[command(subcommand)]
2025-04-27 08:36:57 +09:00
command: Command,
2025-04-24 09:26:24 +09:00
}
2025-04-27 08:36:57 +09:00
#[derive(Clone, Debug, Subcommand)]
2025-04-24 09:26:24 +09:00
enum Command {
2025-05-06 22:15:29 +09:00
Init(InitArgs),
2025-04-24 09:26:24 +09:00
Record(RecordArgs),
}
2025-05-06 22:15:29 +09:00
#[tokio::main]
async fn main() -> Result<(), Error> {
2025-05-04 11:10:14 +09:00
let cli = Cli::parse();
match cli.command {
//Some(Commands::Add(x)) => x.run(),
2025-05-08 06:33:08 +09:00
Command::Init(x) => x.run().await,
2025-05-04 11:10:14 +09:00
//Some(Commands::Label(x)) => x.run(),
Command::Record(x) => x.run(),
2025-04-24 09:26:24 +09:00
}
2025-04-22 14:38:32 +09:00
}