From 8aae200ebfd541364159916c60c73f5cd5b6b592 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Thu, 9 Dec 2021 17:01:29 +0000 Subject: [PATCH] :heavy_plus_sign: add `directories` dep and `--version` subcommand --- Cargo.lock | 40 ++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/app_common.rs | 2 ++ src/main.rs | 1 + src/prelude.rs | 1 + 5 files changed, 45 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 825ad3e..93e1ed9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,26 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "directories" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "getrandom" version = "0.2.3" @@ -56,6 +76,7 @@ dependencies = [ name = "lookaround" version = "0.1.5" dependencies = [ + "directories", "mac_address", "rand", "thiserror", @@ -195,6 +216,25 @@ dependencies = [ "rand_core", ] +[[package]] +name = "redox_syscall" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +dependencies = [ + "getrandom", + "redox_syscall", +] + [[package]] name = "syn" version = "1.0.82" diff --git a/Cargo.toml b/Cargo.toml index 8d0b66d..1c59128 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ repository = "https://six-five-six-four.com/git/reactor/lookaround" version = "0.1.5" [dependencies] +directories = "4.0.1" mac_address = "1.1.2" rand = "0.8.4" thiserror = "1.0.30" diff --git a/src/app_common.rs b/src/app_common.rs index 068b468..38e0e36 100644 --- a/src/app_common.rs +++ b/src/app_common.rs @@ -1,5 +1,7 @@ use crate::prelude::*; +pub const LOOKAROUND_VERSION: &'static str = env! ("CARGO_PKG_VERSION"); + #[derive (Debug, thiserror::Error)] pub enum AppError { #[error (transparent)] diff --git a/src/main.rs b/src/main.rs index ccc88c7..600ee1b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,6 +28,7 @@ async fn async_main () -> Result <(), AppError> { match subcommand.as_ref ().map (|x| &x[..]) { None => return Err (CliArgError::MissingSubcommand.into ()), + Some ("--version") => println! ("lookaround v{}", LOOKAROUND_VERSION), Some ("client") => client::client (args).await?, Some ("find-nick") => client::find_nick (args).await?, Some ("my-ips") => my_ips ()?, diff --git a/src/prelude.rs b/src/prelude.rs index 7c35294..46368a1 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -34,6 +34,7 @@ pub use tokio::{ pub use crate::{ app_common::{ self, + LOOKAROUND_VERSION, AppError, CliArgError, recv_msg_from,