Skip to content

Commit 04ef1cd

Browse files
committed
README: document the crate existing
Signed-off-by: Ikey Doherty <ikey@aerynos.com>
1 parent 38b6736 commit 04ef1cd

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

README.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This project provides JSON schemas and examples for representing comprehensive i
1414

1515
While other tools like lsb_release and os-release exist for basic OS identification, this project aims to provide a more comprehensive schema that includes capabilities, resources, and system composition details that those tools don't cover. Where lsb_release focuses on Linux compatibility information and os-release provides basic identification, os-info standardizes metadata about an OS's full feature set and ecosystem.
1616

17-
A Rust library with C bindings is under development to provide a standard way to read and work with this format.
17+
1818

1919
## Schema Structure
2020

@@ -50,15 +50,52 @@ See [`sample.json`](sample.json) for a complete example implementation.
5050

5151
```
5252
.
53+
├── crates/
54+
│ └── os-info/ # Rust library implementation
5355
├── schema/
5456
│ └── 0.1/
5557
│ ├── os-info.schema.json
5658
│ └── technology-capabilities.schema.json
5759
├── technologies/
58-
│ └── *.json
59-
└── sample.json
60+
│ └── *.json # Technology capability definitions
61+
└── sample.json # Example OS info file
62+
```
63+
64+
## Rust Library
65+
66+
The project includes a Rust library for working with os-info files. The library provides:
67+
68+
- Type-safe structs representing the full OS info schema
69+
- Serialization/deserialization via serde
70+
- Helper functions for loading files
71+
- Error handling for common failure cases
72+
73+
### Usage
74+
75+
Add to your `Cargo.toml`:
76+
```toml
77+
[dependencies]
78+
os-info = "0.1"
6079
```
6180

81+
Basic example:
82+
```rust
83+
use os_info::{load_os_info_from_path, load_technology_from_path};
84+
85+
// Load and parse an OS info file
86+
let os_info = load_os_info_from_path("os-info.json")?;
87+
88+
// Access the parsed data
89+
println!("OS Name: {}", os_info.metadata.identity.name);
90+
println!("Version: {}", os_info.metadata.version.full);
91+
92+
// Load technology capabilities
93+
let tech = load_technology_from_path("technologies/moss.json")?;
94+
println!("Technology: {}", tech.name);
95+
```
96+
97+
The library provides strongly-typed structs for all schema components, making it easy to work with OS info data in a type-safe way.
98+
6299
## Contributing
63100

64101
Contributions are welcome! Please feel free to submit pull requests to:

0 commit comments

Comments
 (0)