41 lines
1001 B
Rust
41 lines
1001 B
Rust
use std::env::args;
|
|
|
|
use wolz_lib::{error::WResult, wolz::Wolz};
|
|
|
|
fn main() -> WResult<()> {
|
|
let arg_1 = args().nth(1);
|
|
let Some(arg_1) = arg_1 else {
|
|
print_usage();
|
|
return Ok(());
|
|
};
|
|
|
|
let wolz = Wolz::create()?;
|
|
wolz.wake_up(&arg_1)?;
|
|
Ok(())
|
|
}
|
|
|
|
fn print_usage() {
|
|
println!(
|
|
"{}",
|
|
r#"usage: woly ARG
|
|
|
|
Options:
|
|
ARG Either the mac address of the device to send the wol magic
|
|
packet to, or a nickname specified in woly.conf to lookup
|
|
the mac.
|
|
Eg: woly aa:bb:cc:dd:ee:ff
|
|
Eg: woly potato
|
|
where potato is configured in the woly.conf file as
|
|
potato=aa:bb:cc:dd:ee:ff
|
|
|
|
Config file:
|
|
Filename woly.conf
|
|
Location $WOLY_CONFIG_DIR/woly.conf, then $XDG_CONFIG_DIR/woly.conf,
|
|
then $HOME/woly.conf
|
|
Format one KEY=VALUE per line without spaces
|
|
Example potato=aa:bb:cc:dd:ee:ff
|
|
idly=12:34:23:e2:3d:ff
|
|
"#
|
|
);
|
|
}
|