add `directories` dep and `--version` subcommand

main
_ 2021-12-09 17:01:29 +00:00
parent a0a64cd79c
commit 8aae200ebf
5 changed files with 45 additions and 0 deletions

40
Cargo.lock generated
View File

@ -26,6 +26,26 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 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]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.3" version = "0.2.3"
@ -56,6 +76,7 @@ dependencies = [
name = "lookaround" name = "lookaround"
version = "0.1.5" version = "0.1.5"
dependencies = [ dependencies = [
"directories",
"mac_address", "mac_address",
"rand", "rand",
"thiserror", "thiserror",
@ -195,6 +216,25 @@ dependencies = [
"rand_core", "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]] [[package]]
name = "syn" name = "syn"
version = "1.0.82" version = "1.0.82"

View File

@ -12,6 +12,7 @@ repository = "https://six-five-six-four.com/git/reactor/lookaround"
version = "0.1.5" version = "0.1.5"
[dependencies] [dependencies]
directories = "4.0.1"
mac_address = "1.1.2" mac_address = "1.1.2"
rand = "0.8.4" rand = "0.8.4"
thiserror = "1.0.30" thiserror = "1.0.30"

View File

@ -1,5 +1,7 @@
use crate::prelude::*; use crate::prelude::*;
pub const LOOKAROUND_VERSION: &'static str = env! ("CARGO_PKG_VERSION");
#[derive (Debug, thiserror::Error)] #[derive (Debug, thiserror::Error)]
pub enum AppError { pub enum AppError {
#[error (transparent)] #[error (transparent)]

View File

@ -28,6 +28,7 @@ async fn async_main () -> Result <(), AppError> {
match subcommand.as_ref ().map (|x| &x[..]) { match subcommand.as_ref ().map (|x| &x[..]) {
None => return Err (CliArgError::MissingSubcommand.into ()), None => return Err (CliArgError::MissingSubcommand.into ()),
Some ("--version") => println! ("lookaround v{}", LOOKAROUND_VERSION),
Some ("client") => client::client (args).await?, Some ("client") => client::client (args).await?,
Some ("find-nick") => client::find_nick (args).await?, Some ("find-nick") => client::find_nick (args).await?,
Some ("my-ips") => my_ips ()?, Some ("my-ips") => my_ips ()?,

View File

@ -34,6 +34,7 @@ pub use tokio::{
pub use crate::{ pub use crate::{
app_common::{ app_common::{
self, self,
LOOKAROUND_VERSION,
AppError, AppError,
CliArgError, CliArgError,
recv_msg_from, recv_msg_from,