mod attachment;
mod command;
mod comment;
mod create;
mod delete;
mod edit;
pub(crate) mod ids;
mod json;
mod link;
mod list;
mod show;
mod tag;
pub(crate) mod text;
pub(crate) mod write;
use std::collections::BTreeMap;
use usage_rs::{Args, Subcommands};
use yt::api::custom_fields::IssueCustomField;
#[derive(Args)]
#[usage(run_async_with)]
pub(crate) struct Issue {
#[usage(subcommand)]
command: IssueCommand,
}
#[derive(Subcommands)]
#[usage(run_async_with)]
pub(crate) enum IssueCommand {
Create(create::Create),
Edit(edit::Edit),
Command(command::Apply),
Delete(delete::Delete),
Comment(comment::CommentGroup),
Tag(tag::TagGroup),
Link(link::LinkGroup),
Attachment(attachment::AttachmentGroup),
#[usage(visible_alias = "ls")]
List(list::List),
Show(show::Show),
}
pub(crate) fn fields_json(fields: &[IssueCustomField]) -> BTreeMap<&str, serde_json::Value> {
fields
.iter()
.map(|field| (field.name.as_str(), field.json()))
.collect()
}