Skip to content

Commit b0d44af

Browse files
committed
Move rusp-run binary to the main rusp crate and improve all documentation
Signed-off-by: Daniel Egger <[email protected]>
1 parent 01f21d4 commit b0d44af

File tree

6 files changed

+70
-60
lines changed

6 files changed

+70
-60
lines changed

rhai-rusp/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ readme = "README.md"
99
repository = "https://github.com/axiros/rusp"
1010

1111
[dependencies]
12-
clap = { version = "4", features = ["derive"] }
1312
rhai = { workspace = true }
1413
rusp-lib = { workspace = true }
1514
anyhow = { workspace = true }
1615
quick-protobuf = { workspace = true }
1716
serde = { workspace = true }
1817
serde_derive = { workspace = true }
1918
serde_json = { workspace = true }
20-
21-
[[bin]]
22-
name = "rusp-run"

rhai-rusp/README.md

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# `rhai-rusp`
44

55
`rhai-rusp` is a new approach to address your [USP][] protocol needs by
6-
providing [Rhai][] bindings for the [rusp-lib
7-
crate](https://crates.io/crates/rusp-lib), thus providing scripting capabilities
6+
providing [Rhai][] bindings for the [rusp-lib crate](https://crates.io/crates/rusp-lib), thus providing scripting capabilities
87
to USP in Rhai for either standalone runners or [Rust][] applications which can
98
embed the [Rhai][] interpreter together with the `rhai-rusp` bindings.
109

@@ -28,32 +27,10 @@ The usual steps to embed a Rhai interpreter with rusp support are:
2827
4. Execute the `Rhai` AST via `engine.run_ast(ast)`
2928
5. Handle errors, err... profit!
3029

31-
## How to use `rhai-rusp` directly?
32-
33-
Currently we're including a simply binary called `rusp-run`, demonstrating how
34-
to embed the bindings and allowing you to execute `Rhai` code directly from the
35-
commandline, read either from `stdin` or a file.
30+
There's also the `rusp-run` binary as part of the [rusp crate](https://crates.io/crates/rusp) which you can install via:
3631

3732
```
38-
# rusp-run --script 'let body = rusp::get_builder().with_max_depth(1).with_params(["Device."]).build();
39-
let msg = rusp::msg_builder().with_msg_id ("Foo").with_body (body).build();
40-
print (msg)'
41-
{
42-
"Header": {
43-
"msg_id": "Foo",
44-
"msg_type": "GET"
45-
},
46-
"Body": {
47-
"Request": {
48-
"Get": {
49-
"param_paths": [
50-
"Device."
51-
],
52-
"max_depth": 1
53-
}
54-
}
55-
}
56-
}
33+
# cargo install rusp
5734
```
5835

5936
## What else?
@@ -78,4 +55,4 @@ Licence
7855
[Rhai]: https://rhai.rs
7956
[Rust]: https://www.rust-lang.org/
8057
[USP]: https://usp.technology/
81-
[Axiros]: https://www.axiros.com/
58+
[Axiros]: https://www.axiros.com/

rusp-bin/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ version = "0.95.0"
1313
repository = "axiros/rusp"
1414

1515
[dependencies]
16+
rhai = { workspace = true }
1617
anyhow = { workspace = true }
17-
clap = { version = "4", features = ["derive"] }
18+
clap = { version = "4", default-features = false, features = ["std", "derive"] }
1819
quick-protobuf = { workspace = true }
1920
rusp-lib = { version = "0.95", path = "../rusp-lib" }
21+
rhai-rusp = { version = "0.95", path = "../rhai-rusp" }
2022
serde = { workspace = true }
2123
serde_derive = { workspace = true }
2224
serde_json = { workspace = true }
2325

2426
[[bin]]
2527
name = "rusp"
28+
29+
[[bin]]
30+
name = "rusp-run"

rusp-bin/README.md

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,80 @@
11
![Continuous integration](https://github.com/axiros/rusp/workflows/Continuous%20integration/badge.svg)
22

3-
# rusp-bin
3+
# rusp
44

55
This crate contains the application part of Rusp, which contains:
66

7-
* A **rusp** binary granting access to library functionality via command line. Included functionality at the moment are:
7+
* A `rusp` application, granting access to library functionality via command line. Included functionality at the moment are:
88
* Decoding of **USP** Msg Protobuf bytestreams from standard input
99
* Decoding of **USP** Msg Protobuf bytestreams from file(s)
1010
* Decoding of **USP** Record Protobuf bytestreams from standard input
1111
* Decoding of **USP** Record Protobuf bytestreams from file(s)
1212
* Extraction of **USP** Msg Protobuf bytestreams from the payload of a **USP** Record Protobuf bytestream
1313
* Generation of **USP** Msg Protobuf bytestreams and C char arrays for selected messages and Error
14+
* A `rusp-run` application, providing a simple frontend to the `rhai-rusp` bindings via an embedded [Rhai][] interpreter
1415

15-
## How to use the rusp binary?
16+
In order to download, compile and install the `rusp` binary it is sufficient to have a stable [Rust][] environment and run:
17+
18+
```
19+
# cargo install rusp
20+
```
21+
22+
## How to use the `rusp` binary?
1623

1724
**rusp** includes a binary with the same name demonstrating some of the uses.
1825

1926
At the moment this mostly allows converting Protobuf encapsulated USP **Record** and **Msg** structures into human-readable text and other useful formats like code and to extracting a **Msg** structure from a **Record**.
2027

21-
Currently, it also still supports synthesizing USP Records via command line, however this feature is going to be phased out soon in favour of something way better. 😉
28+
Currently, it also still supports synthesizing USP Records via command line, however this feature is going to be phased out soon in favour of the way more flexible `rhai-rusp`.
2229

23-
In order to download, compile and install the `rusp` binary it is sufficient to have a stable Rust environment and run:
30+
## How to use the `rhai-rusp` binary?
31+
32+
We are now also including a simply binary called `rusp-run`, demonstrating how
33+
to embed the bindings and allowing you to execute `Rhai` code directly via
34+
command line, read either from `stdin` or a file.
2435

2536
```
26-
# cargo install rusp
37+
# rusp-run --script 'let body = rusp::get_builder().with_max_depth(1).with_params(["Device."]).build();
38+
let msg = rusp::msg_builder().with_msg_id ("Foo").with_body (body).build();
39+
print (msg)'
40+
{
41+
"Header": {
42+
"msg_id": "Foo",
43+
"msg_type": "GET"
44+
},
45+
"Body": {
46+
"Request": {
47+
"Get": {
48+
"param_paths": [
49+
"Device."
50+
],
51+
"max_depth": 1
52+
}
53+
}
54+
}
55+
}
2756
```
2857

29-
After this you should be able to use the `rusp` binary, which has built-in help for all the commands to guide the way.
30-
3158
## What else?
3259

33-
You may use this crate however you like under the **BSD 3-Clause Licence**.
34-
35-
The toolkit is still far from feature complete but already a big aid in our product development and also helped to find one or the other discrepancy in the standard.
60+
You may use this crate however you like under the [BSD 3-Clause Licence](LICENSE).
3661

37-
Feel free to spread the word or drop us a note if you like it. Collaboration on this crate is highly welcome as are pull requests in [our GitHub repo](https://github.com/axiros/rusp/).
62+
Feel free to spread the word or drop us a note if you like it. Collaboration on
63+
this crate is highly welcome as are pull requests in [our GitHub
64+
repo](https://github.com/axiros/rusp/).
3865

3966
## Contact us
4067

41-
If you are in need of software for **USP** management software (agent, controller or testing) or expertise please get in touch with us via our [web form](https://www.axiros.com). We're also happy to solve all other device management and monitoring needs!
42-
43-
[Rust]: https://www.rust-lang.org/
44-
[USP]: https://usp.technology/
45-
[BBF]: https://www.broadband-forum.org/
46-
[Axiros]: https://www.axiros.com/
68+
If you are in need of software for [USP][] management software (agent,
69+
controller or testing) or expertise please get [in touch with us][Axiros]. We're
70+
also happy to solve all other device management and monitoring needs!
4771

4872
Licence
4973
-------
5074

5175
[BSD 3-Clause Licence](LICENSE).
76+
77+
[Rhai]: https://rhai.rs
78+
[Rust]: https://www.rust-lang.org/
79+
[USP]: https://usp.technology/
80+
[Axiros]: https://www.axiros.com/
File renamed without changes.

rusp-lib/README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,25 @@ Documentation and examples for its use can be found on [docs.rs](https://docs.rs
3434

3535
## What else?
3636

37-
You may use this crate however you like under the **BSD 3-Clause Licence**.
37+
You may use this crate however you like under the [BSD 3-Clause Licence](LICENSE).
3838

39-
The toolkit is still far from feature complete but already a big aid in our product development and also helped to find one or the other discrepancy in the standard.
40-
41-
Feel free to spread the word or drop us a note if you like it. Collaboration on this crate is highly welcome as are pull requests in [our GitHub repo](https://github.com/axiros/rusp/).
39+
Feel free to spread the word or drop us a note if you like it. Collaboration on
40+
this crate is highly welcome as are pull requests in [our GitHub
41+
repo](https://github.com/axiros/rusp/).
4242

4343
## Contact us
4444

45-
If you are in need of software for **USP** management software (agent, controller or testing) or expertise please get in touch with us via our [web form](https://www.axiros.com). We're also happy to solve all other device management and monitoring needs!
46-
47-
[Rust]: https://www.rust-lang.org/
48-
[USP]: https://usp.technology/
49-
[BBF]: https://www.broadband-forum.org/
50-
[Axiros]: https://www.axiros.com/
45+
If you are in need of software for [USP][] management software (agent,
46+
controller or testing) or expertise please get [in touch with us][Axiros]. We're
47+
also happy to solve all other device management and monitoring needs!
5148

5249
Licence
5350
-------
5451

5552
[BSD 3-Clause Licence](LICENSE).
53+
54+
[Rhai]: https://rhai.rs
55+
[Rust]: https://www.rust-lang.org/
56+
[USP]: https://usp.technology/
57+
[Axiros]: https://www.axiros.com/
58+
[BBF]: https://www.broadband-forum.org/

0 commit comments

Comments
 (0)