Skip to content

Commit cc2ceb0

Browse files
committed
ref: cargo fmt
1 parent 4836d31 commit cc2ceb0

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

cli/src/command/bundle.rs

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
use code0_definition_reader::parser::Parser;
2+
use prost::Message;
13
use std::fs;
24
use std::io::Write;
3-
use prost::Message;
4-
use code0_definition_reader::parser::Parser;
55

66
pub fn bundle(path: Option<String>, out: Option<String>) {
77
let dir_path = path.unwrap_or_else(|| "./definitions".to_string());
@@ -24,25 +24,52 @@ pub fn bundle(path: Option<String>, out: Option<String>) {
2424
feature.data_types.iter().for_each(|data_type| {
2525
let mut buf = Vec::new();
2626
if let Ok(_) = data_type.encode(&mut buf) {
27-
let path = format!("{}/{}_{}_{}.pb",&out_path, feature.name, "data_type", data_type.identifier.to_lowercase());
28-
fs::File::create(&path).expect("abc").write_all(&buf).expect("a");
27+
let path = format!(
28+
"{}/{}_{}_{}.pb",
29+
&out_path,
30+
feature.name,
31+
"data_type",
32+
data_type.identifier.to_lowercase()
33+
);
34+
fs::File::create(&path)
35+
.expect("abc")
36+
.write_all(&buf)
37+
.expect("a");
2938
}
3039
});
3140

3241
feature.flow_types.iter().for_each(|flow_type| {
3342
let mut buf = Vec::new();
3443
if let Ok(_) = flow_type.encode(&mut buf) {
35-
let path = format!("{}/{}_{}_{}.pb",&out_path, feature.name, "flow_type", flow_type.identifier.to_lowercase());
36-
fs::File::create(&path).expect("abc").write_all(&buf).expect("a");
44+
let path = format!(
45+
"{}/{}_{}_{}.pb",
46+
&out_path,
47+
feature.name,
48+
"flow_type",
49+
flow_type.identifier.to_lowercase()
50+
);
51+
fs::File::create(&path)
52+
.expect("abc")
53+
.write_all(&buf)
54+
.expect("a");
3755
}
3856
});
3957

4058
feature.runtime_functions.iter().for_each(|function| {
4159
let mut buf = Vec::new();
4260
if let Ok(_) = function.encode(&mut buf) {
43-
let path = format!("{}/{}_{}_{}.pb",&out_path, feature.name, "function", function.runtime_name.to_lowercase());
44-
fs::File::create(&path).expect("abc").write_all(&buf).expect("a");
61+
let path = format!(
62+
"{}/{}_{}_{}.pb",
63+
&out_path,
64+
feature.name,
65+
"function",
66+
function.runtime_name.to_lowercase()
67+
);
68+
fs::File::create(&path)
69+
.expect("abc")
70+
.write_all(&buf)
71+
.expect("a");
4572
}
4673
});
4774
}
48-
}
75+
}

cli/src/command/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
pub mod bundle;
12
pub mod definition;
23
pub mod download;
34
pub mod feature;
45
pub mod report;
56
pub mod watch;
6-
pub mod bundle;

cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ enum Commands {
5858
path: Option<String>,
5959
#[arg(short, long)]
6060
out: Option<String>,
61-
}
61+
},
6262
}
6363

6464
#[tokio::main]
6565
async fn main() {
6666
let cli = Cli::parse();
6767

6868
match cli.command {
69-
Commands::Bundle {path, out} => command::bundle::bundle(path, out),
69+
Commands::Bundle { path, out } => command::bundle::bundle(path, out),
7070
Commands::Report { path } => command::report::report_errors(path),
7171
Commands::Feature { name, path } => command::feature::search_feature(name, path),
7272
Commands::Definition { name, path } => command::definition::search_definition(name, path),

0 commit comments

Comments
 (0)