https://github.com/clearfeld/rjc
CLI tool that converts the output of various command-line tools, file-types, and common string formats into JSON, YAML, or TOML. Allowing for further piping to tools like jq and simplifying automation scripts.
https://github.com/clearfeld/rjc
cli convert json parsers rust-library text-processing toml yaml
Last synced: about 2 months ago
JSON representation
CLI tool that converts the output of various command-line tools, file-types, and common string formats into JSON, YAML, or TOML. Allowing for further piping to tools like jq and simplifying automation scripts.
- Host: GitHub
- URL: https://github.com/clearfeld/rjc
- Owner: clearfeld
- License: mpl-2.0
- Created: 2023-01-14T21:24:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-26T01:24:28.000Z (almost 3 years ago)
- Last Synced: 2025-03-15T21:18:11.224Z (over 1 year ago)
- Topics: cli, convert, json, parsers, rust-library, text-processing, toml, yaml
- Language: Rust
- Homepage: https://rjc.vercel.app
- Size: 228 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# rjc
```bash
dir | rjc dir
```
```json
{"meta":{"drive":"F","serial":"38EC-3395","directory":"F:\\Dev\\rjc","files":3,"directories":4},"resources":[{"date":"01/15/2023","time":"04:14 PM","is_dir":true,"size":null,"name":"."},{"date":"01/15/2023","time":"04:14 PM","is_dir":true,"size":null,"name":".."},{"date":"01/14/2023","time":"04:25 PM","is_dir":false,"size":8,"name":".gitignore"},{"date":"01/15/2023","time":"10:38 PM","is_dir":false,"size":11117,"name":"Cargo.lock"},{"date":"01/20/2023","time":"12:53 AM","is_dir":false,"size":437,"name":"Cargo.toml"},{"date":"01/21/2023","time":"02:18 PM","is_dir":true,"size":null,"name":"src"},{"date":"01/20/2023","time":"12:53 AM","is_dir":true,"size":null,"name":"target"}]}
```
## Installation
### Cargo Install (MacOS, Linux, Windows)
```bash
cargo install rjc
```
### Binaries
For precompiled binaries, check the [releases](https://github.com/clearfeld/rjc/releases) in this repo.
## Library
`rjc` can also be used as a library.
```rust
use rjc::win32::dir::{DirData, parse};
use std::process::Command;
fn main() {
let output = Command::new("cmd").args(["/C", "dir"]).output().expect("Failed to execute process.");
let dir_data: DirData = parse(Some(String::from_utf8_lossy(&output.stdout).to_string()));
println!("{}", dir_data.meta.drive);
}
```
## Parsers
### Win32
| Commands | Documentation |
| --------- | -------------------------------------------------------- |
| assoc | [details](https://rjc.vercel.app/parsers/win32/assoc) |
| dir | [details](https://rjc.vercel.app/parsers/win32/dir) |
| netstat | [details](https://rjc.vercel.app/parsers/win32/netstat) |
| tasklist | [details](https://rjc.vercel.app/parsers/win32/tasklist) |
### Unix
| Commands | Documentation |
| ------------ | ------------------------------------------------------------ |
| acpi | [details](https://rjc.vercel.app/parsers/unix/acpi) |
| arp | [details](https://rjc.vercel.app/parsers/unix/arp) |
| chage | [details](https://rjc.vercel.app/parsers/unix/chage) |
| cksum | [details](https://rjc.vercel.app/parsers/unix/cksum) |
| date | [details](https://rjc.vercel.app/parsers/unix/date) |
| du | [details](https://rjc.vercel.app/parsers/unix/du) |
| env | [details](https://rjc.vercel.app/parsers/unix/env) |
| file | [details](https://rjc.vercel.app/parsers/unix/file) |
| ls | [details](https://rjc.vercel.app/parsers/unix/ls) |
| passwd | [details](https://rjc.vercel.app/parsers/unix/passwd) |
| time | [details](https://rjc.vercel.app/parsers/unix/time) |
| timedatectl | [details](https://rjc.vercel.app/parsers/unix/timedatectl) |
| shadow | [details](https://rjc.vercel.app/parsers/unix/shadow) |
| sysctl | [details](https://rjc.vercel.app/parsers/unix/sysctl) |
| w | [details](https://rjc.vercel.app/parsers/unix/w) |
| wc | [details](https://rjc.vercel.app/parsers/unix/wc) |
### Darwin
| Commands | Documentation |
| ----------- | -------------------------------------------------------- |
| airport | [details](https://rjc.vercel.app/parsers/darwin/airport) |
### External
| Commands | Documentation |
| -------------------------------------------- | ----------------------------------------------------- |
| [lsd](https://github.com/Peltoche/lsd) | [details](https://rjc.vercel.app/parsers/common/lsd) |
| ping | [details](https://rjc.vercel.app/parsers/common/ping) |
### Formats
| Commands | Documentation |
| ----------------- | ----------------------------------------------------------- |
| email-address | [details](https://rjc.vercel.app/parsers/formats/email) |
| semver | [details](https://rjc.vercel.app/parsers/formats/semver) |
| timestamp | [details](https://rjc.vercel.app/parsers/formats/timestamp) |
| version | [details](https://rjc.vercel.app/parsers/formats/version) |