Skip to content

Commit

Permalink
tui command line flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebenfield committed Dec 11, 2024
1 parent 79b7da9 commit d3b618e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions interpreter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mod value;
use value::*;

mod ui;
use ui::Ui as _;
use ui::Ui;

mod dialoguer_input;

Expand Down Expand Up @@ -125,11 +125,12 @@ pub fn interpret(
aleo_filenames: &[PathBuf],
signer: SvmAddress,
block_height: u32,
tui: bool,
) -> Result<()> {
let mut interpreter = Interpreter::new(leo_filenames.iter(), aleo_filenames.iter(), signer, block_height)?;

// let mut user_interface = dialoguer_input::DialoguerUi::new();
let mut user_interface = ratatui_ui::RatatuiUi::new();
let mut user_interface: Box<dyn Ui> =
if tui { Box::new(ratatui_ui::RatatuiUi::new()) } else { Box::new(dialoguer_input::DialoguerUi::new()) };

let mut code = String::new();
let mut futures = Vec::new();
Expand Down
7 changes: 5 additions & 2 deletions leo/cli/commands/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ pub struct LeoDebug {
#[arg(long, help = "The block height, accessible via block.height.", default_value = "0")]
pub(crate) block_height: u32,

#[arg(long, action, help = "Use the text user interface.")]
pub(crate) tui: bool,

#[clap(flatten)]
pub(crate) compiler_options: BuildOptions,
}
Expand Down Expand Up @@ -128,7 +131,7 @@ fn handle_debug<N: Network>(command: &LeoDebug, context: Context) -> Result<()>
Vec::new()
};

leo_interpreter::interpret(&paths, &aleo_paths, address, command.block_height)
leo_interpreter::interpret(&paths, &aleo_paths, address, command.block_height, command.tui)
} else {
let private_key: PrivateKey<TestnetV0> = PrivateKey::from_str(leo_package::VALIDATOR_0_PRIVATE_KEY)?;
let address = Address::try_from(&private_key)?;
Expand All @@ -146,6 +149,6 @@ fn handle_debug<N: Network>(command: &LeoDebug, context: Context) -> Result<()>
.map(|path_str| path_str.into())
.collect();

leo_interpreter::interpret(&leo_paths, &aleo_paths, address, command.block_height)
leo_interpreter::interpret(&leo_paths, &aleo_paths, address, command.block_height, command.tui)
}
}

0 comments on commit d3b618e

Please sign in to comment.