codegen-rust now takes the input file from a CLI parameter
This commit is contained in:
parent
4cfc6425e1
commit
1881fb99ce
|
@ -2713,9 +2713,6 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kifu-l10n"
|
name = "kifu-l10n"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
|
||||||
"messages-codegen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kv-log-macro"
|
name = "kv-log-macro"
|
||||||
|
@ -2732,12 +2729,15 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"chrono-tz",
|
"chrono-tz",
|
||||||
|
"convert_case",
|
||||||
"fixed_decimal",
|
"fixed_decimal",
|
||||||
"fluent",
|
"fluent",
|
||||||
"fluent-ergonomics",
|
"fluent-ergonomics",
|
||||||
"icu",
|
"icu",
|
||||||
"icu_locid",
|
"icu_locid",
|
||||||
"icu_provider",
|
"icu_provider",
|
||||||
|
"serde 1.0.193",
|
||||||
|
"serde_yaml",
|
||||||
"sys-locale",
|
"sys-locale",
|
||||||
"unic-langid",
|
"unic-langid",
|
||||||
]
|
]
|
||||||
|
@ -2917,17 +2917,6 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "messages-codegen"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"convert_case",
|
|
||||||
"quote",
|
|
||||||
"serde 1.0.193",
|
|
||||||
"serde_yaml",
|
|
||||||
"syn 2.0.48",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
|
|
|
@ -8,12 +8,15 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = { version = "0.4" }
|
chrono = { version = "0.4" }
|
||||||
chrono-tz = { version = "0.8" }
|
chrono-tz = { version = "0.8" }
|
||||||
|
convert_case = { version = "0.6" }
|
||||||
fixed_decimal = { version = "0.5.5", features = [ "ryu" ] }
|
fixed_decimal = { version = "0.5.5", features = [ "ryu" ] }
|
||||||
fluent = { version = "0.16" }
|
fluent = { version = "0.16" }
|
||||||
fluent-ergonomics = { path = "../fluent-ergonomics" }
|
fluent-ergonomics = { path = "../fluent-ergonomics" }
|
||||||
icu = { version = "1" }
|
icu = { version = "1" }
|
||||||
icu_locid = { version = "1" }
|
icu_locid = { version = "1" }
|
||||||
icu_provider = { version = "1" }
|
icu_provider = { version = "1" }
|
||||||
|
serde = { version = "1" }
|
||||||
|
serde_yaml = { version = "0.9" }
|
||||||
sys-locale = { version = "0.3" }
|
sys-locale = { version = "0.3" }
|
||||||
unic-langid = { version = "*" }
|
unic-langid = { version = "*" }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use convert_case::{Case, Casing};
|
use convert_case::{Case, Casing};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_yaml;
|
use serde_yaml;
|
||||||
use std::{collections::HashMap, fmt, fs::File};
|
use std::{collections::HashMap, fmt, fs::File, env};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
struct MessageJS {
|
struct MessageJS {
|
||||||
|
@ -121,8 +121,11 @@ impl Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let mut args = env::args();
|
||||||
|
let _ = args.next();
|
||||||
|
let input_file = args.next().unwrap();
|
||||||
let messages: HashMap<String, MessageJS> =
|
let messages: HashMap<String, MessageJS> =
|
||||||
serde_yaml::from_reader(File::open("test-data/messages.yaml").unwrap()).unwrap();
|
serde_yaml::from_reader(File::open(input_file).unwrap()).unwrap();
|
||||||
|
|
||||||
let messages = messages
|
let messages = messages
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
Loading…
Reference in New Issue