Prepare release v0.3 (#19)
* cleanup the wakey binary * add changelog * update versions * update readme
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wakey-wake"
|
||||
version = "0.2.2"
|
||||
version = "0.3.0"
|
||||
|
||||
authors = ["Hubert Bugaj<lesny.rumcajs@gmail.com>"]
|
||||
edition = "2021"
|
||||
@@ -14,4 +14,4 @@ categories = ["network-programming"]
|
||||
|
||||
[dependencies]
|
||||
wakey = { path = "../wakey" }
|
||||
clap = { version = "4.0.15", features = ["derive"] }
|
||||
clap = { version = "4.0", features = ["derive"] }
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
use clap::Parser;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(about = "WakeOnLan a device. https://github.com/LesnyRumcajs/wakey.git", long_about = None)]
|
||||
#[clap(author, version, about, long_about = None)]
|
||||
struct CmdArgs {
|
||||
/// mac address to send packet to
|
||||
#[clap(short, long)]
|
||||
mac: Option<String>,
|
||||
/// MAC address to send packet to. Should be in format AA:BB:CC:DD:EE:FF, AA-BB-CC-DD-EE-FF or
|
||||
/// AA/BB/CC/DD/EE/FF.
|
||||
mac_address: String,
|
||||
}
|
||||
|
||||
fn main() -> wakey::Result<()> {
|
||||
let args = CmdArgs::parse();
|
||||
if let Some(m) = args.mac {
|
||||
let sep = m.chars().find(|ch| *ch == ':' || *ch == '-').unwrap_or('/');
|
||||
let wol = wakey::WolPacket::from_string(&m, sep)?;
|
||||
if wol.send_magic().is_ok() {
|
||||
println!("sent the magic packet.");
|
||||
} else {
|
||||
println!("failed to send the magic packet.");
|
||||
}
|
||||
let mac_adress = CmdArgs::parse().mac_address;
|
||||
let sep = mac_adress
|
||||
.chars()
|
||||
.find(|ch| *ch == ':' || *ch == '-' || *ch == '/')
|
||||
.expect("Invalid MAC address format. Please use one of the separators: [:, -, /]");
|
||||
let wol = wakey::WolPacket::from_string(&mac_adress, sep)?;
|
||||
if wol.send_magic().is_ok() {
|
||||
println!("Sent the magic packet.");
|
||||
} else {
|
||||
println!("give mac address to wake up");
|
||||
println!("Failed to send the magic packet.");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user