Update clap deprecated api (#132)
This commit is contained in:
@@ -8,7 +8,7 @@ use std::str;
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[clap(
|
#[command(
|
||||||
name = "mini-redis-cli",
|
name = "mini-redis-cli",
|
||||||
version,
|
version,
|
||||||
author,
|
author,
|
||||||
@@ -18,10 +18,10 @@ struct Cli {
|
|||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
command: Command,
|
command: Command,
|
||||||
|
|
||||||
#[clap(name = "hostname", long, default_value = "127.0.0.1")]
|
#[arg(id = "hostname", long, default_value = "127.0.0.1")]
|
||||||
host: String,
|
host: String,
|
||||||
|
|
||||||
#[clap(long, default_value_t = DEFAULT_PORT)]
|
#[arg(long, default_value_t = DEFAULT_PORT)]
|
||||||
port: u16,
|
port: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ struct Cli {
|
|||||||
enum Command {
|
enum Command {
|
||||||
Ping {
|
Ping {
|
||||||
/// Message to ping
|
/// Message to ping
|
||||||
#[clap(value_parser = bytes_from_str)]
|
#[arg(value_parser = bytes_from_str)]
|
||||||
msg: Option<Bytes>,
|
msg: Option<Bytes>,
|
||||||
},
|
},
|
||||||
/// Get the value of key.
|
/// Get the value of key.
|
||||||
@@ -43,11 +43,11 @@ enum Command {
|
|||||||
key: String,
|
key: String,
|
||||||
|
|
||||||
/// Value to set.
|
/// Value to set.
|
||||||
#[clap(value_parser = bytes_from_str)]
|
#[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
|
||||||
#[clap(value_parser = duration_from_ms_str)]
|
#[arg(value_parser = duration_from_ms_str)]
|
||||||
expires: Option<Duration>,
|
expires: Option<Duration>,
|
||||||
},
|
},
|
||||||
/// Publisher to send a message to a specific channel.
|
/// Publisher to send a message to a specific channel.
|
||||||
@@ -55,7 +55,7 @@ enum Command {
|
|||||||
/// Name of channel
|
/// Name of channel
|
||||||
channel: String,
|
channel: String,
|
||||||
|
|
||||||
#[clap(value_parser = bytes_from_str)]
|
#[arg(value_parser = bytes_from_str)]
|
||||||
/// Message to publish
|
/// Message to publish
|
||||||
message: Bytes,
|
message: Bytes,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ pub async fn main() -> mini_redis::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[clap(name = "mini-redis-server", version, author, about = "A Redis server")]
|
#[command(name = "mini-redis-server", version, author, about = "A Redis server")]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
#[clap(long)]
|
#[arg(long)]
|
||||||
port: Option<u16>,
|
port: Option<u16>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user