33 lines
899 B
Rust
33 lines
899 B
Rust
mod cli;
|
|
mod cmd;
|
|
mod jira_config;
|
|
mod jql;
|
|
mod types;
|
|
|
|
use clap::Parser;
|
|
use cli::{Cli, Commands};
|
|
use jira_config::JiraConfig;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
let cli = Cli::parse();
|
|
|
|
match cli.command {
|
|
Commands::Create {
|
|
project,
|
|
open,
|
|
markdown_file,
|
|
} => cmd::create::create(project, open, markdown_file).await?,
|
|
Commands::List { json } => {
|
|
let jql = "assignee = currentUser() AND resolution = Unresolved order by updated DESC";
|
|
cmd::search::exec(json, jql).await?
|
|
},
|
|
Commands::Search { json, jql } => cmd::search::exec(json, &jql).await?,
|
|
Commands::Init { url, email, token } => {
|
|
JiraConfig::init(url, email, token).await?;
|
|
println!("Configuration initialized successfully!");
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|