Prepare release v0.3 (#19)

* cleanup the wakey binary

* add changelog

* update versions

* update readme
This commit is contained in:
Hubert
2023-01-06 22:01:34 +01:00
committed by GitHub
parent 23f9a53a26
commit 0868354063
5 changed files with 41 additions and 23 deletions

View File

@@ -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"] }

View File

@@ -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(())