Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Thomas Locher <[email protected]>
  • Loading branch information
sesi200 and THLO authored Nov 23, 2023
1 parent 6a0a86d commit 743e375
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ The message "transaction is a duplicate of another transaction in block ...", pr

### feat: accept more ways to specify cycle and e8s amounts

`_` can now be to make large numbers more readable. For example: `dfx canister deposit-cycles 1_234_567 mycanister`
Underscores (`_`) can now be used to make large numbers more readable. For example: `dfx canister deposit-cycles 1_234_567 mycanister`

Certain suffixes that replace a number of zeros are now supported. The (case insensiteve) suffixes are:
Certain suffixes that replace a number of zeros are now supported. The (case-insensitive) suffixes are:
- `k` for `000`, e.g. `500k`
- `m` for `000_000`, e.g. `5m`
- `b` for `000_000_000`, e.g. `50B`
Expand Down
4 changes: 2 additions & 2 deletions src/dfx/src/util/clap/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use byte_unit::{Byte, ByteUnit};
use rust_decimal::Decimal;
use std::{path::PathBuf, str::FromStr};

/// Removes `_`, interprets `k`, `m`, `b`, `t` suffix (case insensitive)
/// Removes `_`, interprets `k`, `m`, `b`, `t` suffix (case-insensitive)
fn decimal_with_suffix_parser(input: &str) -> Result<Decimal, String> {
let input = input.replace("_", "").to_lowercase();
let (number, suffix) = if input
Expand Down Expand Up @@ -49,7 +49,7 @@ pub fn request_id_parser(v: &str) -> Result<String, String> {
pub fn e8s_parser(input: &str) -> Result<u64, String> {
decimal_with_suffix_parser(input)?
.try_into()
.map_err(|_| "Must specify a non negative whole number.".to_string())
.map_err(|_| "Must specify a non-negative whole number.".to_string())
}

pub fn memo_parser(memo: &str) -> Result<u64, String> {
Expand Down

0 comments on commit 743e375

Please sign in to comment.