Skip to content

Commit

Permalink
Merge pull request #7 from mirumirumi/dev
Browse files Browse the repository at this point in the history
Fix symbol name cannot include number digits
  • Loading branch information
mirumirumi authored Oct 31, 2023
2 parents 37d4fea + 8786a5e commit 2f8c92b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ro-soku"
version = "0.1.1"
version = "0.1.2"
authors = ["mirumi <[email protected]>"]
edition = "2021"
description = "Retrieve OHLCV ro-soku (means a candle in Japanese) from any exchange🕯️"
Expand Down
7 changes: 5 additions & 2 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,11 @@ impl Cli {

fn check_symbol_format(&self) -> Result<(), Error> {
ensure!(
self.symbol.chars().all(|c| c.is_uppercase() || c == '/') && self.symbol.contains('/'),
"Symbol pair must be in uppercase and contain `/`."
self.symbol
.chars()
.all(|c| c.is_uppercase() || c.is_ascii_digit() || c == '/')
&& self.symbol.contains('/'),
"Symbol pair must be in uppercase or number and contain `/`."
);
Ok(())
}
Expand Down
7 changes: 5 additions & 2 deletions src/guide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ impl Guide {
.with_initial_text("BTC/USDT")
.validate_with(|input: &String| {
ensure!(
input.chars().all(|c| c.is_uppercase() || c == '/') && input.contains('/'),
"Symbol pair must be in uppercase and contain `/`."
input
.chars()
.all(|c| c.is_uppercase() || c.is_ascii_digit() || c == '/')
&& input.contains('/'),
"Symbol pair must be in uppercase or number and contain `/`."
);
Ok(())
})
Expand Down

0 comments on commit 2f8c92b

Please sign in to comment.