Skip to content

Commit

Permalink
Fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
mobycrypt committed Dec 12, 2024
1 parent aa6f44c commit 2f4b95b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 23 deletions.
12 changes: 6 additions & 6 deletions bin/sozo/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(crate) mod migrate;
pub(crate) mod model;
pub(crate) mod options;
pub(crate) mod test;
pub(crate) mod verify;
pub(crate) mod walnut;

use build::BuildArgs;
use call::CallArgs;
Expand All @@ -34,7 +34,7 @@ use inspect::InspectArgs;
use migrate::MigrateArgs;
use model::ModelArgs;
use test::TestArgs;
use verify::VerifyArgs;
use walnut::WalnutArgs;

#[derive(Debug, Subcommand)]
pub enum Commands {
Expand Down Expand Up @@ -65,8 +65,8 @@ pub enum Commands {
Model(Box<ModelArgs>),
#[command(about = "Inspect events emitted by the world")]
Events(Box<EventsArgs>),
#[command(about = "Verify contracts in walnut.dev - transactions debugger and simulator")]
WalnutVerify(Box<VerifyArgs>),
#[command(about = "Interact with walnut.dev - transactions debugger and simulator")]
Walnut(Box<WalnutArgs>),
}

impl fmt::Display for Commands {
Expand All @@ -85,7 +85,7 @@ impl fmt::Display for Commands {
Commands::Init(_) => write!(f, "Init"),
Commands::Model(_) => write!(f, "Model"),
Commands::Events(_) => write!(f, "Events"),
Commands::WalnutVerify(_) => write!(f, "WalnutVerify"),
Commands::Walnut(_) => write!(f, "WalnutVerify"),

Check warning on line 88 in bin/sozo/src/commands/mod.rs

View check run for this annotation

Codecov / codecov/patch

bin/sozo/src/commands/mod.rs#L88

Added line #L88 was not covered by tests
}
}
}
Expand All @@ -112,7 +112,7 @@ pub fn run(command: Commands, config: &Config) -> Result<()> {
Commands::Init(args) => args.run(config),
Commands::Model(args) => args.run(config),
Commands::Events(args) => args.run(config),
Commands::WalnutVerify(args) => args.run(config),
Commands::Walnut(args) => args.run(config),

Check warning on line 115 in bin/sozo/src/commands/mod.rs

View check run for this annotation

Codecov / codecov/patch

bin/sozo/src/commands/mod.rs#L115

Added line #L115 was not covered by tests
}
}

Expand Down
17 changes: 0 additions & 17 deletions bin/sozo/src/commands/verify.rs

This file was deleted.

33 changes: 33 additions & 0 deletions bin/sozo/src/commands/walnut.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
use anyhow::Result;
use clap::{Args, Subcommand};
use scarb::core::Config;
use sozo_walnut::WalnutDebugger;

#[derive(Debug, Args)]
pub struct WalnutArgs {
#[command(subcommand)]
pub command: WalnutVerifyCommand,
}

#[derive(Debug, Subcommand)]
pub enum WalnutVerifyCommand {
#[command(about = "Verify contracts in walnut.dev - essential for debugging source code in Walnut")]
Verify(WalnutVerifyOptions),
}

#[derive(Debug, Args)]
pub struct WalnutVerifyOptions {}

impl WalnutArgs {
pub fn run(self, config: &Config) -> Result<()> {
let ws = scarb::ops::read_workspace(config.manifest_path(), config)?;
config.tokio_handle().block_on(async {
match self.command {
WalnutVerifyCommand::Verify(_options) => {
WalnutDebugger::verify(&ws).await?;

Check warning on line 27 in bin/sozo/src/commands/walnut.rs

View check run for this annotation

Codecov / codecov/patch

bin/sozo/src/commands/walnut.rs#L22-L27

Added lines #L22 - L27 were not covered by tests
}
}
Ok(())
})
}

Check warning on line 32 in bin/sozo/src/commands/walnut.rs

View check run for this annotation

Codecov / codecov/patch

bin/sozo/src/commands/walnut.rs#L30-L32

Added lines #L30 - L32 were not covered by tests
}

0 comments on commit 2f4b95b

Please sign in to comment.