Skip to content

Commit 1b35f4a

Browse files
committed
Migrate to GitQL 0.38.0
1 parent ecdfb66 commit 1b35f4a

File tree

4 files changed

+79
-71
lines changed

4 files changed

+79
-71
lines changed

Cargo.lock

Lines changed: 53 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ categories = ["command-line-utilities"]
1313
exclude = [".github/**", "docs/**", "media/**", "scripts/**"]
1414

1515
[dependencies]
16-
gitql-core = "0.14.0"
17-
gitql-std = "0.14.0"
18-
gitql-cli = "0.37.0"
19-
gitql-ast = "0.33.0"
20-
gitql-parser = "0.36.0"
21-
gitql-engine = "0.37.0"
16+
gitql-core = "0.15.0"
17+
gitql-std = "0.15.0"
18+
gitql-cli = "0.38.0"
19+
gitql-ast = "0.34.0"
20+
gitql-parser = "0.37.0"
21+
gitql-engine = "0.38.0"
2222
clang-sys = { version = "1.8.1", features = ["clang_16_0"] }
2323
dyn-clone = "1.0.19"
2424

src/arguments.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gitql_cli::arguments::OutputFormat;
1+
use gitql_cli::printer::OutputFormatKind;
22

33
/// Arguments for ClangQL
44
#[derive(Debug, PartialEq)]
@@ -7,7 +7,7 @@ pub struct Arguments {
77
pub analysis: bool,
88
pub pagination: bool,
99
pub page_size: usize,
10-
pub output_format: OutputFormat,
10+
pub output_format: OutputFormatKind,
1111
}
1212

1313
/// Create a new instance of Arguments with the default settings
@@ -18,7 +18,7 @@ impl Arguments {
1818
analysis: false,
1919
pagination: false,
2020
page_size: 10,
21-
output_format: OutputFormat::Render,
21+
output_format: OutputFormatKind::Table,
2222
}
2323
}
2424
}
@@ -140,15 +140,16 @@ pub fn parse_arguments(args: &[String]) -> Command {
140140

141141
let output_type = &args[arg_index].to_lowercase();
142142
if output_type == "csv" {
143-
arguments.output_format = OutputFormat::CSV;
143+
arguments.output_format = OutputFormatKind::CSV;
144144
} else if output_type == "json" {
145-
arguments.output_format = OutputFormat::JSON;
146-
} else if output_type == "render" {
147-
arguments.output_format = OutputFormat::Render;
145+
arguments.output_format = OutputFormatKind::JSON;
146+
} else if output_type == "render" || output_type == "table" {
147+
arguments.output_format = OutputFormatKind::Table;
148+
} else if output_type == "yaml" {
149+
arguments.output_format = OutputFormatKind::YAML;
148150
} else {
149151
return Command::Error("Invalid output format".to_string());
150152
}
151-
152153
arg_index += 1;
153154
}
154155
_ => return Command::Error(format!("Unknown command {}", arg)),

src/main.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ use arguments::Command;
77
use clang_ql::clang_parser::parse_files;
88
use clang_ql::data_provider::ClangDataProvider;
99
use clang_ql::schema::create_clang_ql_environment;
10-
use gitql_cli::arguments::OutputFormat;
1110
use gitql_cli::diagnostic_reporter;
1211
use gitql_cli::diagnostic_reporter::DiagnosticReporter;
13-
use gitql_cli::printer::base::OutputPrinter;
14-
use gitql_cli::printer::csv_printer::CSVPrinter;
15-
use gitql_cli::printer::json_printer::JSONPrinter;
16-
use gitql_cli::printer::table_printer::TablePrinter;
12+
use gitql_cli::printer::BaseOutputPrinter;
13+
use gitql_cli::printer::CSVPrinter;
14+
use gitql_cli::printer::JSONPrinter;
15+
use gitql_cli::printer::OutputFormatKind;
16+
use gitql_cli::printer::TablePrinter;
17+
use gitql_cli::printer::YAMLPrinter;
1718
use gitql_core::environment::Environment;
1819
use gitql_engine::data_provider::DataProvider;
1920
use gitql_engine::engine;
@@ -180,12 +181,13 @@ fn execute_clang_ql_query(
180181
// Render the result only if they are selected groups not any other statement
181182
let engine_duration = engine_start.elapsed();
182183

183-
let printer: Box<dyn OutputPrinter> = match arguments.output_format {
184-
OutputFormat::Render => {
184+
let printer: Box<dyn BaseOutputPrinter> = match arguments.output_format {
185+
OutputFormatKind::Table => {
185186
Box::new(TablePrinter::new(arguments.pagination, arguments.page_size))
186187
}
187-
OutputFormat::JSON => Box::new(JSONPrinter {}),
188-
OutputFormat::CSV => Box::new(CSVPrinter {}),
188+
OutputFormatKind::JSON => Box::new(JSONPrinter),
189+
OutputFormatKind::CSV => Box::new(CSVPrinter),
190+
OutputFormatKind::YAML => Box::new(YAMLPrinter),
189191
};
190192

191193
// Render the result only if they are selected groups not any other statement

0 commit comments

Comments
 (0)