Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit a772e02

Browse files
authored
Updated dependencies (#117)
1 parent fb283a7 commit a772e02

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

aws_lambda_events/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ http-body = "0.4"
2121
http-serde = "^1"
2222
serde = "^1"
2323
serde_derive = "^1"
24-
serde_with = { version = "^1", features = ["json"], optional = true }
24+
serde_with = { version = "^2", features = ["json"], optional = true }
2525
serde_json = "^1"
2626
bytes = { version = "1", features = ["serde"] }
2727
chrono = { version = "^0.4.4", default-features = false, features = ["serde", "std"] }
28-
query_map = { version = "^0.5", features = ["serde"] }
28+
query_map = { version = "^0.6", features = ["serde"] }
2929
flate2 = { version = "1.0.24", optional = true }
3030

3131
[dev-dependencies]
32-
pretty_assertions = "0.7"
32+
pretty_assertions = "1.3"
3333

3434
# There are two kinds of features, `static` and `generated`.
3535
# The `static` features reference features that we manually implement in the crate.

aws_lambda_events_codegen/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ publish = false
66
edition = "2018"
77

88
[dependencies]
9-
quicli = "0.2"
9+
quicli = "0.4"
10+
structopt = "0.2"
1011
glob = "0.3"
1112
go_to_rust = { path = "./go_to_rust" }
1213
codegen = { git = "https://github.com/calavera/codegen.git", branch = "structure_attributes"}
13-
toml_edit = "0.13.0"
14+
toml_edit = "0.14.0"

aws_lambda_events_codegen/src/main.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ extern crate quicli;
44
use quicli::prelude::*;
55
use std::collections::{HashMap, HashSet};
66
use std::fs::{self, File};
7-
use std::io::prelude::*;
87
use std::io::Write;
8+
use std::io::{self, prelude::*};
99
use std::path::{Path, PathBuf};
1010
use std::process::Command;
11+
use structopt::StructOpt;
1112

1213
#[derive(Debug)]
1314
struct ExampleEvent {
@@ -40,9 +41,9 @@ struct Cli {
4041
/// Overwrite existing files
4142
#[structopt(long = "overwrite")]
4243
overwrite: bool,
43-
/// Verbose output. Pass many times for more log output
44-
#[structopt(long = "verbose", short = "v", parse(from_occurrences))]
45-
verbosity: u8,
44+
45+
#[structopt(flatten)]
46+
verbose: Verbosity,
4647
}
4748

4849
fn get_ignorelist() -> HashSet<String> {
@@ -98,7 +99,7 @@ fn write_mod_index(
9899
mod_path: &Path,
99100
parsed_files: &[ParsedEventFile],
100101
overwrite: bool,
101-
) -> Result<()> {
102+
) -> io::Result<()> {
102103
if overwrite_warning(mod_path, overwrite).is_none() {
103104
let mut mod_content: Vec<String> = Vec::new();
104105
for parsed in parsed_files {
@@ -127,7 +128,7 @@ fn write_cargo_features(
127128
cargo_path: &Path,
128129
parsed_files: &[ParsedEventFile],
129130
overwrite: bool,
130-
) -> Result<()> {
131+
) -> Result<(), Error> {
131132
if overwrite_warning(cargo_path, overwrite).is_none() {
132133
let buf = std::fs::read_to_string(cargo_path)?;
133134
let mut doc = buf.parse::<toml_edit::Document>()?;
@@ -163,7 +164,7 @@ fn write_cargo_features(
163164
Ok(())
164165
}
165166

166-
fn write_readme(readme_path: &Path, git_hash: &str, overwrite: bool) -> Result<()> {
167+
fn write_readme(readme_path: &Path, git_hash: &str, overwrite: bool) -> io::Result<()> {
167168
if overwrite_warning(readme_path, overwrite).is_none() {
168169
let version_text = format!(
169170
"Generated from commit [{}](https://github.com/aws/aws-lambda-go/commit/{}).",
@@ -188,7 +189,7 @@ fn fuzz(string: &mut String) {
188189
string.retain(|c| c != '_' && c != '-')
189190
}
190191

191-
fn get_fuzzy_file_listing(dir_path: &Path) -> Result<HashMap<String, PathBuf>> {
192+
fn get_fuzzy_file_listing(dir_path: &Path) -> Result<HashMap<String, PathBuf>, Error> {
192193
let mut listing = HashMap::new();
193194
for entry in fs::read_dir(dir_path)? {
194195
let entry = entry?;
@@ -507,7 +508,7 @@ fn read_example_event(test_fixture: &Path) -> String {
507508
contents
508509
}
509510

510-
fn write_fixture(example_event: &ExampleEvent, out_dir: &Path, overwrite: bool) -> Result<()> {
511+
fn write_fixture(example_event: &ExampleEvent, out_dir: &Path, overwrite: bool) -> io::Result<()> {
511512
// Write the example event to the output location.
512513
let full = out_dir.join("fixtures").join(&example_event.name);
513514
{
@@ -525,7 +526,7 @@ fn write_fixture(example_event: &ExampleEvent, out_dir: &Path, overwrite: bool)
525526
Ok(())
526527
}
527528

528-
fn generate_test_module(example_events: &[ExampleEvent]) -> Result<codegen::Module> {
529+
fn generate_test_module(example_events: &[ExampleEvent]) -> io::Result<codegen::Module> {
529530
let mut test_module = codegen::Module::new("test");
530531
test_module.annotation(vec!["cfg(test)"]);
531532
test_module.import("super", "*");
@@ -577,7 +578,10 @@ fn generate_test_function(
577578
test_function
578579
}
579580

580-
main!(|args: Cli, log_level: verbosity| {
581+
fn main() -> CliResult {
582+
let args = Cli::from_args();
583+
args.verbose.setup_env_logger(env!("CARGO_PKG_NAME"))?;
584+
581585
let mut parsed_files: Vec<ParsedEventFile> = Vec::new();
582586

583587
// The glob pattern we are going to use to find the go files with event defs.
@@ -680,7 +684,9 @@ main!(|args: Cli, log_level: verbosity| {
680684
if let Some(cargo_path) = find_cargo_file(&args.output_location) {
681685
write_cargo_features(&cargo_path, &parsed_files, args.overwrite)?;
682686
}
683-
});
687+
688+
Ok(())
689+
}
684690

685691
fn find_cargo_file(base: &Path) -> Option<PathBuf> {
686692
if let Some(path) = base.parent() {

0 commit comments

Comments
 (0)