From 2697b4b84875ed9272252c0d37772c222df53888 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sat, 9 Oct 2021 14:09:21 -0600 Subject: [PATCH] Added README.md LICENSE.md + Also made --help more useful --- LICENSE | 7 +++++++ README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 4 +++- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4c5cd06 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2021 Joey Hines + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..d73a29b --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# Formaty +A simple configurable binary data parser. Data structures are described using TOML files. + +## Example +Checkout the formats described in [formats](./formats) + +```bash +./formaty formats/ccsds.toml ccsds "[0xe0, 0xa1, 0xc0, 0x00, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05]" +```` + +Output: +``` +Version Number: 0 +Packet Type: 0 +Secondary Header Flag: 0 +APID: 1295 +Sequency Flags: 0 +Packet Sequence Count: 48 +Data Length: 5 +Data: [1, 2, 3, 4, 5] +``` + +## Help +``` +Formaty 0.1.0 +Arbitrary Binary Data Formatting + +USAGE: + formaty [data]... + +FLAGS: + -h, --help Prints help information + -V, --version Prints version information + +ARGS: + Path to the format config + Format to parse data as + ... Raw data + +``` + +## License +[License](./LICENSE) \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 6c54472..cfaf1b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,11 +10,13 @@ mod parser; #[derive(Debug, StructOpt)] #[structopt(name = "Formaty", about = "Arbitrary Binary Data Formatting")] pub struct Args { - #[structopt(parse(from_os_str))] + #[structopt(parse(from_os_str), help = "Path to the format config")] config: PathBuf, + #[structopt(help = "Format to parse data as")] format: String, + #[structopt(help = "Raw data")] data: Vec, }