apply client/cli polish (#15)

Continuation of #11. Refines the client structure and implements GET.

`clap` is decoupled from the lib code. This is done to avoid any CLI
parsing concerns to leak into the lib. The main motivation for this is
to allow the reader to focus on Tokio concerns and not CLI parsing
concerns.
This commit is contained in:
Carl Lerche
2020-04-01 16:09:41 -07:00
committed by GitHub
parent 7bd7086d41
commit bbb80c341e
17 changed files with 297 additions and 210 deletions

View File

@@ -1,12 +1,12 @@
use anyhow::{anyhow, Result};
use clap::Clap;
use mini_redis::{server, DEFAULT_PORT};
use clap::Clap;
#[tokio::main]
pub async fn main() -> Result<()> {
pub async fn main() -> mini_redis::Result<()> {
// enable logging
// see https://docs.rs/tracing for more info
tracing_subscriber::fmt::try_init().map_err(|e| anyhow!("{:?}", e))?;
tracing_subscriber::fmt::try_init()?;
let cli = Cli::parse();
let port = cli.port.unwrap_or(DEFAULT_PORT.to_string());