diff options
author | stuebinm | 2022-12-01 00:50:46 +0100 |
---|---|---|
committer | stuebinm | 2022-12-01 00:50:46 +0100 |
commit | 037ec595a3926d7af5ae5816d4e791e7130c3696 (patch) | |
tree | e84025e829a0c81739ac546ca856b36383e84dcd | |
parent | 23c6195d83d4cc09545468982dda92c549d4a877 (diff) |
readme & stuff
-rw-r--r-- | Cargo.lock | 3 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Readme.md | 35 | ||||
-rw-r--r-- | src/main.rs | 10 |
4 files changed, 47 insertions, 3 deletions
@@ -538,6 +538,9 @@ name = "owo-colors" version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +dependencies = [ + "supports-color", +] [[package]] name = "parking_lot" @@ -17,4 +17,4 @@ reqwest = { version = "0.11", features = ["json", "rustls-tls"], default-feature tokio = { version = "1", features = ["full"] } clap = { version = "4", features = ["derive"] } miette = { version = "5", features = ["fancy"] } -owo-colors = "3.5" +owo-colors = { version = "3.5", features = ["supports-color"] } diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..a34e921 --- /dev/null +++ b/Readme.md @@ -0,0 +1,35 @@ +# human-readable gtfs realtime feeds + +a tool to answer to the question "how to check that the gtfs realtime feed says +what it's supposed to if for some unfortunate reason you can't read binary?". + +At 188 crates, it might be suspected that it gives a *slightly* over-engineered +answer. + +~~~ +Usage: showrt [OPTIONS] <URL> + +Arguments: + <URL> uri of the GTFS RT feed to fetch & display + +Options: + --json emit the feed as json + -i, --ignore-nonfatal ignore things that look wrong as long as possible + --no-colors don't do terminal colours + -h, --help Print help information + -V, --version Print version information +~~~ + +### Features: + - fetch feeds from some url + - display feeds in protobuf pseudo-format, optionally with fancy colours + - dump the entire feed as json to process it with `jq` & friends + - error messages with entirely too many arrows in them + +### Still Todo: + - open local files (why do people even have these?) + - play nice with (input-)pipes + - optionally convert all dates into something more human-friendly than seconds + since the unix epoch + - optionally collapse translations that contain only one language in the output + diff --git a/src/main.rs b/src/main.rs index 59e7e51..315d093 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,8 +17,12 @@ struct Args { /// emit the feed as json #[arg(long)] json: bool, + /// ignore things that look wrong as long as possible #[arg(long="ignore-nonfatal", short='i')] - ignore_nonfatal: bool + ignore_nonfatal: bool, + /// don't do terminal colours + #[arg(long="no-colors")] + no_colors: bool } @@ -52,7 +56,9 @@ async fn main() -> miette::Result<()> { match args.json { true => println!("{}", protobuf_json_mapping::print_to_string(&proto).into_diagnostic()?), - false => + false if args.no_colors => + println!("{}", protobuf::text_format::print_to_string_pretty(&proto)), + false => println!("{}", fancy::print_to_string_fancy(&proto)) } |