Skip to content

Commit

Permalink
replace tabled with no std alt
Browse files Browse the repository at this point in the history
  • Loading branch information
juan518munoz committed Nov 27, 2023
1 parent b4fd077 commit 0589670
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rusqlite_migration = { version = "1.0" }
rand = { version="0.8.5" }
serde = {version="1.0", features = ["derive"]}
serde_json = { version = "1.0", features = ["raw_value"] }
tabled = "0.14.0"
cli-table = "0.4.7"

[dev-dependencies]
ctor = "0.2.5"
37 changes: 18 additions & 19 deletions src/cli/account.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use clap::Parser;
use cli_table::{print_stdout, Cell, Style, Table};
use crypto::{dsa::rpo_falcon512::KeyPair, Felt};
use miden_client::{Client, ClientConfig};
use miden_lib::{faucets, AuthScheme};
use objects::{accounts::AccountType, assets::TokenSymbol};
use rand::Rng;
use tabled::{builder::Builder, settings::Style};

// ACCOUNT COMMAND
// ================================================================================================
Expand Down Expand Up @@ -77,27 +77,26 @@ fn list_accounts() -> Result<(), String> {
let client = Client::new(ClientConfig::default()).map_err(|err| err.to_string())?;
let accounts = client.get_accounts().map_err(|err| err.to_string())?;

let mut builder = Builder::new();
builder.push_record([
"account id",
"code root",
"vault root",
"storage root",
"nonce",
]);

let mut rows = vec![];
for acct in accounts {
builder.push_record([
&acct.id().to_string(),
&acct.code_root().to_string(),
&acct.vault_root().to_string(),
&acct.storage_root().to_string(),
&acct.nonce().to_string(),
]);
let mut row = vec![];
row.push(acct.id().cell());
row.push(acct.code_root().cell());
row.push(acct.vault_root().cell());
row.push(acct.storage_root().cell());
row.push(acct.nonce().cell());
rows.push(row);
}

let table = builder.build().with(Style::modern()).to_string();
println!("{}", table);
let table = rows.table().title(vec![
"account id".cell().bold(true),
"code root".cell().bold(true),
"vault root".cell().bold(true),
"storage root".cell().bold(true),
"nonce".cell().bold(true),
]);

print_stdout(table).map_err(|err| err.to_string())?;
Ok(())
}

Expand Down

0 comments on commit 0589670

Please sign in to comment.