parent
ef8918d517
commit
2697b4b848
|
@ -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.
|
|
@ -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 <config> <format> [data]...
|
||||||
|
|
||||||
|
FLAGS:
|
||||||
|
-h, --help Prints help information
|
||||||
|
-V, --version Prints version information
|
||||||
|
|
||||||
|
ARGS:
|
||||||
|
<config> Path to the format config
|
||||||
|
<format> Format to parse data as
|
||||||
|
<data>... Raw data
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
[License](./LICENSE)
|
|
@ -10,11 +10,13 @@ mod parser;
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
#[structopt(name = "Formaty", about = "Arbitrary Binary Data Formatting")]
|
#[structopt(name = "Formaty", about = "Arbitrary Binary Data Formatting")]
|
||||||
pub struct Args {
|
pub struct Args {
|
||||||
#[structopt(parse(from_os_str))]
|
#[structopt(parse(from_os_str), help = "Path to the format config")]
|
||||||
config: PathBuf,
|
config: PathBuf,
|
||||||
|
|
||||||
|
#[structopt(help = "Format to parse data as")]
|
||||||
format: String,
|
format: String,
|
||||||
|
|
||||||
|
#[structopt(help = "Raw data")]
|
||||||
data: Vec<String>,
|
data: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue