This commit is contained in:
parent
044583141c
commit
6a5af6b4f4
36
README.md
36
README.md
|
@ -33,15 +33,15 @@ cargo run -- <args>
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```text
|
||||||
Usage: servicepoint-cli [OPTIONS] <COMMAND>
|
Usage: servicepoint-cli [OPTIONS] <COMMAND>
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
reset-everything Reset both pixels and brightness [aliases: r]
|
reset Reset both pixels and brightness [aliases: r]
|
||||||
pixels Commands for manipulating pixels [aliases: p]
|
pixels Commands for manipulating pixels [aliases: p]
|
||||||
brightness Commands for manipulating the brightness [aliases: b]
|
brightness Commands for manipulating the brightness [aliases: b]
|
||||||
text Commands for sending text to the screen [aliases: t]
|
text Commands for sending text to the screen [aliases: t]
|
||||||
help Print this message or the help of the given subcommand(s)
|
help Print this message or the help of the given subcommand(s)
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-d, --destination <DESTINATION> ip:port of the servicepoint display [default: 127.0.0.1:2342]
|
-d, --destination <DESTINATION> ip:port of the servicepoint display [default: 127.0.0.1:2342]
|
||||||
|
@ -53,7 +53,7 @@ Options:
|
||||||
|
|
||||||
### Pixels
|
### Pixels
|
||||||
|
|
||||||
```
|
```text
|
||||||
Commands for manipulating pixels
|
Commands for manipulating pixels
|
||||||
|
|
||||||
Usage: servicepoint-cli pixels <COMMAND>
|
Usage: servicepoint-cli pixels <COMMAND>
|
||||||
|
@ -68,7 +68,7 @@ Commands:
|
||||||
|
|
||||||
#### Image
|
#### Image
|
||||||
|
|
||||||
```
|
```text
|
||||||
Send an image file (e.g. jpeg or png) to the display.
|
Send an image file (e.g. jpeg or png) to the display.
|
||||||
|
|
||||||
Usage: servicepoint-cli pixels image [OPTIONS] <FILE_NAME>
|
Usage: servicepoint-cli pixels image [OPTIONS] <FILE_NAME>
|
||||||
|
@ -87,7 +87,7 @@ Options:
|
||||||
|
|
||||||
#### Screen
|
#### Screen
|
||||||
|
|
||||||
```
|
```text
|
||||||
Stream the default screen capture source to the display. On Linux Wayland, this pops up a screen or window chooser, but it also may directly start streaming your main screen.
|
Stream the default screen capture source to the display. On Linux Wayland, this pops up a screen or window chooser, but it also may directly start streaming your main screen.
|
||||||
|
|
||||||
Usage: servicepoint-cli pixels screen [OPTIONS]
|
Usage: servicepoint-cli pixels screen [OPTIONS]
|
||||||
|
@ -104,7 +104,7 @@ Options:
|
||||||
|
|
||||||
### Brightness
|
### Brightness
|
||||||
|
|
||||||
```
|
```text
|
||||||
Commands for manipulating the brightness
|
Commands for manipulating the brightness
|
||||||
|
|
||||||
Usage: servicepoint-cli brightness <COMMAND>
|
Usage: servicepoint-cli brightness <COMMAND>
|
||||||
|
@ -117,18 +117,18 @@ Commands:
|
||||||
|
|
||||||
### Text
|
### Text
|
||||||
|
|
||||||
```
|
```text
|
||||||
Commands for sending text to the screen
|
Commands for sending text to the screen
|
||||||
|
|
||||||
Usage: servicepoint-cli text <COMMAND>
|
Usage: servicepoint-cli text <COMMAND>
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
stdin Pipe text to the display, example: `journalctl | servicepoint-cli stream stdin`
|
stdin Pipe text to the display, example: `journalctl | servicepoint-cli text stdin`
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Stdin
|
#### Stdin
|
||||||
|
|
||||||
```
|
```text
|
||||||
Pipe text to the display, example: `journalctl | servicepoint-cli stream stdin`
|
Pipe text to the display, example: `journalctl | servicepoint-cli stream stdin`
|
||||||
|
|
||||||
Usage: servicepoint-cli stream stdin [OPTIONS]
|
Usage: servicepoint-cli stream stdin [OPTIONS]
|
||||||
|
@ -137,6 +137,16 @@ Options:
|
||||||
-s, --slow Wait for a short amount of time before sending the next line
|
-s, --slow Wait for a short amount of time before sending the next line
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Reset
|
||||||
|
|
||||||
|
```text
|
||||||
|
Reset both pixels and brightness
|
||||||
|
|
||||||
|
Usage: servicepoint-cli reset [OPTIONS]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-f, --force hard reset screen
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,10 @@ pub struct Cli {
|
||||||
#[derive(clap::Parser, std::fmt::Debug)]
|
#[derive(clap::Parser, std::fmt::Debug)]
|
||||||
pub enum Mode {
|
pub enum Mode {
|
||||||
#[command(visible_alias = "r", about = "Reset both pixels and brightness")]
|
#[command(visible_alias = "r", about = "Reset both pixels and brightness")]
|
||||||
ResetEverything,
|
Reset {
|
||||||
|
#[arg(short, long, help = "hard reset screen")]
|
||||||
|
force: bool,
|
||||||
|
},
|
||||||
#[command(visible_alias = "p")]
|
#[command(visible_alias = "p")]
|
||||||
Pixels {
|
Pixels {
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
|
@ -114,7 +117,7 @@ pub enum TransportType {
|
||||||
#[clap(about = "Commands for sending text to the screen")]
|
#[clap(about = "Commands for sending text to the screen")]
|
||||||
pub enum TextCommand {
|
pub enum TextCommand {
|
||||||
#[command(
|
#[command(
|
||||||
about = "Pipe text to the display, example: `journalctl | servicepoint-cli stream stdin`"
|
about = "Pipe text to the display, example: `journalctl | servicepoint-cli text stdin`"
|
||||||
)]
|
)]
|
||||||
Stdin {
|
Stdin {
|
||||||
#[arg(
|
#[arg(
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -7,7 +7,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use servicepoint::{Brightness, UdpSocketExt};
|
use servicepoint::{Brightness, HardResetCommand, UdpSocketExt};
|
||||||
|
|
||||||
mod brightness;
|
mod brightness;
|
||||||
mod cli;
|
mod cli;
|
||||||
|
@ -32,9 +32,13 @@ fn main() {
|
||||||
|
|
||||||
pub fn execute_mode(mode: Mode, connection: Transport) {
|
pub fn execute_mode(mode: Mode, connection: Transport) {
|
||||||
match mode {
|
match mode {
|
||||||
Mode::ResetEverything => {
|
Mode::Reset { force } => {
|
||||||
brightness_set(&connection, Brightness::MAX);
|
if force {
|
||||||
pixels_off(&connection);
|
connection.send_command(HardResetCommand).unwrap()
|
||||||
|
} else {
|
||||||
|
brightness_set(&connection, Brightness::MAX);
|
||||||
|
pixels_off(&connection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Mode::Pixels { pixel_command } => pixels(&connection, pixel_command),
|
Mode::Pixels { pixel_command } => pixels(&connection, pixel_command),
|
||||||
Mode::Brightness { brightness_command } => brightness(&connection, brightness_command),
|
Mode::Brightness { brightness_command } => brightness(&connection, brightness_command),
|
||||||
|
|
Loading…
Reference in a new issue