jirac/src/cli.rs
2025-01-21 21:32:23 +01:00

64 lines
1.4 KiB
Rust

use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Create an issue
Create {
/// The project key in which to create the issue
#[arg(long)]
project: Option<String>,
/// Open the new issue in a browser
#[arg(long)]
open: bool,
/// A Markdown file
#[arg(value_name = "MARKDOWN_FILE")]
markdown_file: Option<PathBuf>,
},
/// Find issues currently assigned to you
List {
/// Print JSON rather than pretty print
#[arg(long)]
json: bool,
},
/// Search for issues
Search {
/// Print JSON rather than pretty print
#[arg(long)]
json: bool,
/// A JQL string
#[arg(value_name = "JQL")]
jql: String,
},
View {
/// Print JSON rather than pretty print
#[arg(long)]
json: bool,
/// An issue key, for example, KEY-123
#[arg(value_name = "ISSUE")]
issue: String,
},
/// Set up the configuration
Init {
/// Jira instance URL
#[arg(long)]
url: String,
/// User email
#[arg(long)]
email: String,
/// User Token
#[arg(long)]
token: String,
},
}