Skip to content

Commit

Permalink
Add map command to the cli
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxxu committed Jan 30, 2024
1 parent 804034c commit ffa7ba2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions binaries/flo-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod game;
mod grpc;
mod kinesis;
mod lan;
mod map;
mod observer;
mod replay;
mod server;
Expand Down Expand Up @@ -39,6 +40,10 @@ enum Opt {
#[structopt(subcommand)]
cmd: replay::Command,
},
Map {
#[structopt(subcommand)]
cmd: map::Command,
},
}

#[tokio::main]
Expand Down Expand Up @@ -68,6 +73,9 @@ async fn main() -> Result<()> {
Opt::Replay { cmd } => {
cmd.run().await?;
}
Opt::Map { cmd } => {
cmd.run().await?;
}
}

Ok(())
Expand Down
23 changes: 23 additions & 0 deletions binaries/flo-cli/src/map.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use flo_w3map::W3Map;
use std::path::PathBuf;
use structopt::StructOpt;

use crate::Result;

#[derive(Debug, StructOpt)]
pub enum Command {
Inspect { path: PathBuf },
}

impl Command {
pub async fn run(&self) -> Result<()> {
match *self {
Command::Inspect { ref path } => {
let (map, checksum) = W3Map::open_with_checksum(path)?;
println!("Checkdsum: {:?}", checksum);
println!("Map Name: {}", map.name());
}
}
Ok(())
}
}

0 comments on commit ffa7ba2

Please sign in to comment.