1pub mod changelog_extractor;
2pub mod json_printer;
3pub mod macros;
4pub mod table_printer;
5
6use jira_v3_openapi::models::{
7 CreatedIssue, FieldCreateMetadata, IssueBean, IssueTransition, IssueTypeIssueCreateMetadata,
8 Project, Version,
9};
10use serde_json::Value;
11
12use crate::args::commands::OutputValues;
13
14pub enum PrintableData {
23 Generic {
24 data: Vec<Value>,
25 },
26 IssueCreated {
27 issues: Vec<CreatedIssue>,
28 },
29 IssueData {
30 issues: Vec<IssueBean>,
31 },
32 IssueTransitions {
33 transitions: Vec<IssueTransition>,
34 },
35 IssueType {
36 issue_types: Vec<IssueTypeIssueCreateMetadata>,
37 },
38 IssueTypeField {
39 issue_type_fields: Vec<FieldCreateMetadata>,
40 },
41 Project {
42 projects: Vec<Project>,
43 },
44 TransitionedIssue {
45 issues: Vec<(String, String, String, String)>,
46 },
47 Version {
48 versions: Vec<Version>,
49 },
50}
51
52pub enum OutputType {
53 Full,
54 Basic,
55 Single,
56}
57
58pub fn print_data(data: PrintableData, output_format: OutputValues, output_type: OutputType) {
59 match output_format {
60 OutputValues::Json => {
61 json_printer::print_json(data);
62 }
63 OutputValues::Table => match output_type {
64 OutputType::Full => {
65 table_printer::print_table_full(data);
66 }
67 OutputType::Basic => {
68 table_printer::print_table_basic(data);
69 }
70 OutputType::Single => {
71 table_printer::print_table_single(data);
72 }
73 },
74 }
75}