Skip to content

Commit 64a98a4

Browse files
committed
Normalize new lines
1 parent bd9cb32 commit 64a98a4

5 files changed

Lines changed: 8 additions & 10 deletions

File tree

registry_wizard/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ fn main() {
231231
fn output_result(result: BoxResult<String>) {
232232
match result {
233233
Ok(s) => {
234-
writeln!(io::stdout(), "{}", s).ok()
234+
write!(io::stdout(), "{}", s).ok()
235235
}
236236
Err(err) => {
237237
writeln!(io::stderr(), "{}", err).ok();

registry_wizard/src/modules/hierarchical_prefixes.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ pub fn output(registry_root: &Path, v4: bool) -> BoxResult<String> {
6868
cidr.borrow().cidr.eq(&IpCidr::from_str("::/0").unwrap())).
6969
ok_or("could not find root element")?;
7070

71-
72-
let j = serde_json::to_string(&root)?;
73-
Ok(j)
71+
Ok(serde_json::to_string(&root)? + "\n")
7472
}
7573

7674
fn is_in_subnet(target: IpCidr, test: IpCidr) -> bool {

registry_wizard/src/modules/object_finder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn output(registry_root: &Path, search_ip: &str) -> BoxResult<String> {
3737
if let Some(current) = current {
3838
let target_path = Path::new(registry_root).join(sub_path).join(current);
3939
let key_value = read_registry_object_kv::<SimpleObjectLine>(target_path.as_path())?;
40-
Ok(serde_json::to_string(&key_value)?)
40+
Ok(serde_json::to_string(&key_value)? + "\n")
4141
} else {
4242
Err("Failed to find target".into())
4343
}

registry_wizard/src/modules/object_metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ pub fn output(registry_root: &Path, object_type: &str,
2323
}
2424
objects.insert(item.filename, item.key_value);
2525
}
26-
Ok(serde_json::to_string(&objects)?)
26+
Ok(serde_json::to_string(&objects)? + "\n")
2727
}

registry_wizard/src/modules/registry_graph_tools.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn output_list(registry_root: &Path, obj_type: Option<String>, object_name:
2626
if graphviz {
2727
Ok(create_graphviz(v.to_vec(), None)?)
2828
} else {
29-
Ok(serde_json::to_string(v)?)
29+
Ok(serde_json::to_string(v)? + "\n")
3030
}
3131
}
3232
Some(n) => {
@@ -37,7 +37,7 @@ pub fn output_list(registry_root: &Path, obj_type: Option<String>, object_name:
3737
.ok_or("object type not found")?
3838
.iter().find(|x| x.object.filename == n)
3939
.ok_or("object by name not found");
40-
Ok(serde_json::to_string(r)?)
40+
Ok(serde_json::to_string(r)? + "\n")
4141
}
4242
}
4343
}
@@ -117,7 +117,7 @@ pub fn output_related(registry_root: &Path, obj_type: String,
117117
let result: Vec<_> = visited.iter()
118118
.map(|x| format!("{}/{}", x.schema_ref, x.object.filename))
119119
.collect();
120-
Ok(serde_json::to_string(&result)?)
120+
Ok(serde_json::to_string(&result)?+"\n")
121121
}
122122

123123

@@ -185,5 +185,5 @@ pub fn output_path(registry_root: &Path, src_type: String, tgt_type: String,
185185

186186
Ok(rev_path.iter().rev()
187187
.map(|x| format!("{}/{}", x.schema_ref, x.object.filename.clone()))
188-
.collect::<Vec<String>>().join(" > "))
188+
.collect::<Vec<String>>().join(" > ") + "\n")
189189
}

0 commit comments

Comments
 (0)