Skip to content

Commit 5d079cd

Browse files
authored
Merge branch 'main' into contributing
2 parents 10182c3 + f2af721 commit 5d079cd

File tree

3 files changed

+156
-1
lines changed

3 files changed

+156
-1
lines changed

Cargo.lock

Lines changed: 128 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

burrow/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ crate-type = ["lib", "staticlib"]
99
[dependencies]
1010
tokio = { version = "1.21", features = ["rt", "macros"] }
1111
tun = { version = "0.1", path = "../tun" }
12+
clap = { version = "4.3.2", features = ["derive"] }

burrow/src/main.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
1+
use clap::{Args, Parser, Subcommand};
12
use tokio::io::Result;
23
use tun::TunInterface;
34

5+
#[derive(Parser)]
6+
#[command(name = "Burrow")]
7+
#[command(author = "Hack Club <team@hackclub.com>")]
8+
#[command(version = "0.1")]
9+
#[command(about = "Burrow is a tool for burrowing through firewalls, built by teenagers at Hack Club.", long_about = None)]
10+
11+
struct Cli {
12+
#[command(subcommand)]
13+
command: Commands,
14+
}
15+
16+
#[derive(Subcommand)]
17+
enum Commands {
18+
/// Adds files to myapp
19+
Start(StartArgs),
20+
}
21+
22+
#[derive(Args)]
23+
struct StartArgs {}
24+
425
async fn try_main() -> Result<()> {
526
let iface = TunInterface::new()?;
627
println!("{:?}", iface.name());
@@ -10,5 +31,10 @@ async fn try_main() -> Result<()> {
1031

1132
#[tokio::main(flavor = "current_thread")]
1233
async fn main() {
13-
try_main().await.unwrap();
34+
let cli = Cli::parse();
35+
match &cli.command {
36+
Commands::Start(..) => {
37+
try_main().await.unwrap();
38+
}
39+
}
1440
}

0 commit comments

Comments
 (0)