Update READMEs

This commit is contained in:
Aram 🍐 2021-07-31 04:15:22 -04:00
parent abd38f0a99
commit dcbf334cf4
5 changed files with 95 additions and 6 deletions

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020 Aram Peres Copyright (c) 2020-2021 Aram Peres
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -8,20 +8,22 @@
A [Network UPS Tools](https://github.com/networkupstools/nut) (NUT) client library for Rust. A [Network UPS Tools](https://github.com/networkupstools/nut) (NUT) client library for Rust.
- Connect to `upsd`/`nut-server` using TCP - Connect to `upsd`/`nut-server` using TCP
- Login with with username and password - Login with username and password
- List UPS devices - List UPS devices
- List variables for a UPS device - List variables for a UPS device
## ⚠️ Safety Goggles Required ⚠️ ## ⚠️ Safety Goggles Required ⚠️
Do not use this library with critical UPS devices. This library is in early development and I cannot Do not use this library with critical UPS devices. This library is in early development, and I cannot guarantee that it
guarantee that it won't mess up your UPS configurations, and potentially cause catastrophic failure to your hardware. won't mess up your UPS configurations, and potentially cause catastrophic failure to your hardware.
Be careful and stay safe! Be careful and stay safe!
## Example ## Example
Check out the `examples` directory for more advanced examples. The [rupsc](https://github.com/aramperes/nut-client-rs/tree/master/rupsc)
command-line utility is a clone of NUT's built-in [upsc](https://networkupstools.org/docs/man/upsc.html) command-line
utility, written using this library.
```rust ```rust
use std::env; use std::env;
@ -45,6 +47,7 @@ fn main() -> nut_client::Result<()> {
let config = ConfigBuilder::new() let config = ConfigBuilder::new()
.with_host(Host::Tcp(addr)) .with_host(Host::Tcp(addr))
.with_auth(auth) .with_auth(auth)
.with_debug(false) // Turn this on for debugging network chatter
.build(); .build();
let mut conn = Connection::new(config)?; let mut conn = Connection::new(config)?;

View file

@ -7,7 +7,7 @@ description = "A demo program to display UPS variables"
categories = ["network-programming"] categories = ["network-programming"]
keywords = ["ups", "nut"] keywords = ["ups", "nut"]
repository = "https://github.com/aramperes/nut-client-rs" repository = "https://github.com/aramperes/nut-client-rs"
readme = "../README.md" readme = "README.md"
license = "MIT" license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

21
rupsc/LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-2021 Aram Peres
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.

65
rupsc/README.md Normal file
View file

@ -0,0 +1,65 @@
# rupsc
[![crates.io](https://img.shields.io/crates/v/rupsc.svg)](https://crates.io/crates/rupsc)
[![Documentation](https://docs.rs/nut-client/badge.svg)](https://docs.rs/nut-client)
[![MIT licensed](https://img.shields.io/crates/l/rupsc.svg)](./LICENSE)
[![CI](https://github.com/aramperes/nut-client-rs/workflows/CI/badge.svg)](https://github.com/aramperes/nut-client-rs/actions?query=workflow%3ACI)
A Rust clone of [upsc](https://networkupstools.org/docs/man/upsc.html),
the [Network UPS Tools](https://github.com/networkupstools/nut) (NUT) demo program to display UPS variables.
Written using the [nut-client](https://github.com/aramperes/nut-client-rs) crate.
- Connect to `upsd`/`nut-server` using TCP
- List UPS devices
- List variables for a UPS device
- Get variable value of a UPS device
- List clients connected to a UPS device
## Installation
```bash
# Using cargo
cargo install rupsc
# Or, build for other targets
# (make sure you install the appropriate toolchain & gcc linker)
cargo build --release --target armv7-unknown-linux-gnueabihf
cargo build --release --target aarch64-unknown-linux-gnu
cargo build --release --target arm-unknown-linux-gnueabihf
```
## Usage
This is a clone of [`upsc`](https://networkupstools.org/docs/man/upsc.html), so the usage is the same:
```bash
# Show usage
rupsc -h
# List variables on UPS device "nutdev1" (assumes upsd running on 127.0.0.1:3493)
rupsc nutdev1
# List variables on UPS device "nutdev1" (remove upsd)
rupsc nutdev1@192.168.1.2:3493
# List available UPS devices
rupsc -l
# List available UPS devices, with description
rupsc -L
# List clients connected to UPS device "nutdev1"
rupsc -c nutdev1
```
However, there are also some additions:
```bash
# Enable network debugging (global flag).
ruspc -D
```
## Pronunciation
> r-oopsie