Skip to content

Commit

Permalink
Remove clap from simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackHoleFox committed Dec 19, 2023
1 parent 83614b4 commit a33334f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ sodiumoxide = { version = "0.2", optional = true }
byteorder = { version = "1.4", optional = true }

[dev-dependencies]
clap = "4.0"
criterion = "0.5"
serde = "1.0"
serde_json = "1.0"
Expand Down
7 changes: 3 additions & 4 deletions examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
//! as `cargo run --example simple` to see the magic happen.
use lazy_static::lazy_static;

use clap::{arg, Command};
use snow::{params::NoiseParams, Builder};
use std::{
io::{self, Read, Write},
Expand All @@ -25,9 +23,10 @@ lazy_static! {

#[cfg(any(feature = "default-resolver", feature = "ring-accelerated"))]
fn main() {
let matches = Command::new("simple").arg(arg!(-s --server "Server mode")).get_matches();
let server_mode =
std::env::args().next_back().map(|arg| arg == "-s" || arg == "--server").unwrap_or(true);

if matches.contains_id("server") {
if server_mode {
run_server();
} else {
run_client();
Expand Down

0 comments on commit a33334f

Please sign in to comment.