Remove unnecessary custom clap value parser (#147)
Some checks failed
CI / build (push) Failing after 4s
Some checks failed
CI / build (push) Failing after 4s
This commit is contained in:
@@ -2,7 +2,6 @@ use mini_redis::{clients::Client, DEFAULT_PORT};
|
|||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use std::convert::Infallible;
|
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
use std::str;
|
use std::str;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@@ -29,7 +28,6 @@ struct Cli {
|
|||||||
enum Command {
|
enum Command {
|
||||||
Ping {
|
Ping {
|
||||||
/// Message to ping
|
/// Message to ping
|
||||||
#[arg(value_parser = bytes_from_str)]
|
|
||||||
msg: Option<Bytes>,
|
msg: Option<Bytes>,
|
||||||
},
|
},
|
||||||
/// Get the value of key.
|
/// Get the value of key.
|
||||||
@@ -43,7 +41,6 @@ enum Command {
|
|||||||
key: String,
|
key: String,
|
||||||
|
|
||||||
/// Value to set.
|
/// Value to set.
|
||||||
#[arg(value_parser = bytes_from_str)]
|
|
||||||
value: Bytes,
|
value: Bytes,
|
||||||
|
|
||||||
/// Expire the value after specified amount of time
|
/// Expire the value after specified amount of time
|
||||||
@@ -55,7 +52,6 @@ enum Command {
|
|||||||
/// Name of channel
|
/// Name of channel
|
||||||
channel: String,
|
channel: String,
|
||||||
|
|
||||||
#[arg(value_parser = bytes_from_str)]
|
|
||||||
/// Message to publish
|
/// Message to publish
|
||||||
message: Bytes,
|
message: Bytes,
|
||||||
},
|
},
|
||||||
@@ -153,7 +149,3 @@ fn duration_from_ms_str(src: &str) -> Result<Duration, ParseIntError> {
|
|||||||
let ms = src.parse::<u64>()?;
|
let ms = src.parse::<u64>()?;
|
||||||
Ok(Duration::from_millis(ms))
|
Ok(Duration::from_millis(ms))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bytes_from_str(src: &str) -> Result<Bytes, Infallible> {
|
|
||||||
Ok(Bytes::from(src.to_string()))
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user