Skip to content

Commit

Permalink
fix(zk_toolbox): Use slug crate instead of self written function
Browse files Browse the repository at this point in the history
Signed-off-by: Danil <[email protected]>
  • Loading branch information
Deniallugo committed Jun 24, 2024
1 parent 8861f29 commit d9592f9
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 17 deletions.
17 changes: 17 additions & 0 deletions zk_toolbox/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions zk_toolbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ types = { path = "crates/types" }
# External dependencies
anyhow = "1.0.82"
clap = { version = "4.4", features = ["derive", "wrap_help"] }
slug = "0.1.5"
cliclack = "0.2.5"
console = "0.15.8"
ethers = "2.0"
Expand Down
10 changes: 4 additions & 6 deletions zk_toolbox/crates/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
pub use prerequisites::check_prerequisites;
pub use prompt::{init_prompt_theme, Prompt, PromptConfirm, PromptSelect};
pub use term::{logger, spinner};

pub mod cmd;
pub mod config;
pub mod db;
Expand All @@ -7,11 +11,5 @@ pub mod files;
pub mod forge;
mod prerequisites;
mod prompt;
mod slugify;
mod term;
pub mod wallets;

pub use prerequisites::check_prerequisites;
pub use prompt::{init_prompt_theme, Prompt, PromptConfirm, PromptSelect};
pub use slugify::slugify;
pub use term::{logger, spinner};
3 changes: 0 additions & 3 deletions zk_toolbox/crates/common/src/slugify.rs

This file was deleted.

1 change: 1 addition & 0 deletions zk_toolbox/crates/zk_inception/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ strum.workspace = true
toml.workspace = true
url.workspace = true
thiserror.workspace = true
slug.workspace = true
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{path::PathBuf, str::FromStr};

use clap::Parser;
use common::{slugify, Prompt, PromptConfirm, PromptSelect};
use common::{Prompt, PromptConfirm, PromptSelect};
use serde::{Deserialize, Serialize};
use strum::IntoEnumIterator;
use strum_macros::{Display, EnumIter};
Expand All @@ -26,7 +26,7 @@ use crate::{
pub struct ChainCreateArgs {
#[arg(long)]
pub chain_name: Option<String>,
#[arg(value_parser = clap::value_parser!(u32).range(1..))]
#[arg(value_parser = clap::value_parser ! (u32).range(1..))]
pub chain_id: Option<u32>,
#[clap(long, help = MSG_PROVER_MODE_HELP, value_enum)]
pub prover_mode: Option<ProverMode>,
Expand Down Expand Up @@ -55,7 +55,7 @@ impl ChainCreateArgs {
let mut chain_name = self
.chain_name
.unwrap_or_else(|| Prompt::new(MSG_CHAIN_NAME_PROMPT).ask());
chain_name = slugify(&chain_name);
chain_name = slug::slugify(&chain_name);

let chain_id = self.chain_id.unwrap_or_else(|| {
Prompt::new(MSG_CHAIN_ID_PROMPT)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::Parser;
use common::{db::DatabaseConfig, slugify, Prompt};
use common::{db::DatabaseConfig, Prompt};
use config::ChainConfig;
use serde::{Deserialize, Serialize};
use url::Url;
Expand Down Expand Up @@ -48,7 +48,7 @@ impl GenesisArgs {
.default(DATABASE_SERVER_URL.as_str())
.ask()
});
let server_db_name = slugify(&self.server_db_name.unwrap_or_else(|| {
let server_db_name = slug::slugify(&self.server_db_name.unwrap_or_else(|| {
Prompt::new(&msg_server_db_name_prompt(&chain_name))
.default(&server_name)
.ask()
Expand All @@ -58,7 +58,7 @@ impl GenesisArgs {
.default(DATABASE_PROVER_URL.as_str())
.ask()
});
let prover_db_name = slugify(&self.prover_db_name.unwrap_or_else(|| {
let prover_db_name = slug::slugify(&self.prover_db_name.unwrap_or_else(|| {
Prompt::new(&msg_prover_db_name_prompt(&chain_name))
.default(&prover_name)
.ask()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::PathBuf;

use clap::Parser;
use common::{slugify, Prompt, PromptConfirm, PromptSelect};
use common::{Prompt, PromptConfirm, PromptSelect};
use serde::{Deserialize, Serialize};
use strum::IntoEnumIterator;
use strum_macros::EnumIter;
Expand Down Expand Up @@ -37,7 +37,7 @@ impl EcosystemCreateArgs {
let mut ecosystem_name = self
.ecosystem_name
.unwrap_or_else(|| Prompt::new(MSG_ECOSYSTEM_NAME_PROMPT).ask());
ecosystem_name = slugify(&ecosystem_name);
ecosystem_name = slug::slugify(&ecosystem_name);

let link_to_code = self.link_to_code.unwrap_or_else(|| {
let link_to_code_selection =
Expand Down

0 comments on commit d9592f9

Please sign in to comment.