Skip to content

Commit 1a74d8d

Browse files
authored
Extend convert-json-schema with basic help (#195)
1 parent 9856ed0 commit 1a74d8d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/bin/convert-json-schema.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
use outlines_core::prelude::*;
22

3+
fn print_help() {
4+
println!("JSON Schema to Regex Converter\n");
5+
println!("Usage:");
6+
println!(" cat schema.json | convert-json-schema");
7+
println!(" convert-json-schema --help\n");
8+
println!("Options:");
9+
println!(" --help Show this help message\n");
10+
println!("Description:");
11+
println!(" Reads a JSON Schema from stdin and converts it to a regular expression.");
12+
}
13+
314
fn main() {
15+
if std::env::args().any(|arg| arg == "--help") {
16+
print_help();
17+
return;
18+
}
19+
420
let schema = std::io::read_to_string(std::io::stdin()).unwrap();
521
let regex = json_schema::regex_from_str(&schema, None).unwrap();
622
println!("Regex: {}", regex);

0 commit comments

Comments
 (0)