mirror of
https://github.com/kaesaecracker/servicepoint-simulator.git
synced 2025-01-31 01:30:13 +01:00
reorder CLI args, update README
This commit is contained in:
parent
85b3954c35
commit
8590b38d0f
14
README.md
14
README.md
|
@ -23,7 +23,19 @@ Without nix: check out this repository and use `cargo run --release`.
|
||||||
|
|
||||||
## Command line arguments
|
## Command line arguments
|
||||||
|
|
||||||
The application binds to `0.0.0.0:2342` by default (`./servicepoint-simulator --bind host:port` to change this).
|
```
|
||||||
|
Usage: servicepoint-simulator [OPTIONS]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--bind <BIND> address and port to bind to [default: 0.0.0.0:2342]
|
||||||
|
-f, --font <FONT> The name of the font family to use. This defaults to the system monospace font.
|
||||||
|
-s, --spacers add spacers between tile rows to simulate gaps in real display
|
||||||
|
-r, --red Use the red color channel
|
||||||
|
-g, --green Use the green color channel
|
||||||
|
-b, --blue Use the blue color channel
|
||||||
|
-v, --verbose Set default log level lower. You can also change this via the RUST_LOG environment variable.
|
||||||
|
-h, --help Print help
|
||||||
|
```
|
||||||
|
|
||||||
See [env_logger](https://docs.rs/env_logger/latest/env_logger/) to configure logging.
|
See [env_logger](https://docs.rs/env_logger/latest/env_logger/) to configure logging.
|
||||||
|
|
||||||
|
|
26
src/cli.rs
26
src/cli.rs
|
@ -8,12 +8,6 @@ pub struct Cli {
|
||||||
help = "address and port to bind to"
|
help = "address and port to bind to"
|
||||||
)]
|
)]
|
||||||
pub bind: String,
|
pub bind: String,
|
||||||
#[arg(
|
|
||||||
short,
|
|
||||||
long,
|
|
||||||
help = "Set default log level lower. You can also change this via the RUST_LOG environment variable."
|
|
||||||
)]
|
|
||||||
pub debug: bool,
|
|
||||||
#[arg(
|
#[arg(
|
||||||
short,
|
short,
|
||||||
long,
|
long,
|
||||||
|
@ -22,10 +16,23 @@ pub struct Cli {
|
||||||
pub font: Option<String>,
|
pub font: Option<String>,
|
||||||
#[clap(flatten)]
|
#[clap(flatten)]
|
||||||
pub gui: GuiOptions,
|
pub gui: GuiOptions,
|
||||||
|
#[arg(
|
||||||
|
short,
|
||||||
|
long,
|
||||||
|
help = "Set default log level lower. You can also change this via the RUST_LOG environment variable."
|
||||||
|
)]
|
||||||
|
pub verbose: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
pub struct GuiOptions {
|
pub struct GuiOptions {
|
||||||
|
#[arg(
|
||||||
|
short,
|
||||||
|
long,
|
||||||
|
default_value_t = false,
|
||||||
|
help = "add spacers between tile rows to simulate gaps in real display"
|
||||||
|
)]
|
||||||
|
pub spacers: bool,
|
||||||
#[arg(
|
#[arg(
|
||||||
short,
|
short,
|
||||||
long,
|
long,
|
||||||
|
@ -47,11 +54,4 @@ pub struct GuiOptions {
|
||||||
help = "Use the blue color channel"
|
help = "Use the blue color channel"
|
||||||
)]
|
)]
|
||||||
pub blue: bool,
|
pub blue: bool,
|
||||||
#[arg(
|
|
||||||
short,
|
|
||||||
long,
|
|
||||||
default_value_t = false,
|
|
||||||
help = "add spacers between tile rows to simulate gaps in real display"
|
|
||||||
)]
|
|
||||||
pub spacers: bool,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ fn main() {
|
||||||
cli.gui.green = true;
|
cli.gui.green = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_logging(cli.debug);
|
init_logging(cli.verbose);
|
||||||
info!("starting with args: {:?}", &cli);
|
info!("starting with args: {:?}", &cli);
|
||||||
|
|
||||||
let socket = UdpSocket::bind(&cli.bind).expect("could not bind socket");
|
let socket = UdpSocket::bind(&cli.bind).expect("could not bind socket");
|
||||||
|
|
Loading…
Reference in a new issue