diff --git a/crates/hyperlog-server/src/external_http.rs b/crates/hyperlog-server/src/external_http.rs index ac1c3cb..6913d17 100644 --- a/crates/hyperlog-server/src/external_http.rs +++ b/crates/hyperlog-server/src/external_http.rs @@ -3,7 +3,7 @@ use std::net::SocketAddr; use axum::{extract::MatchedPath, http::Request, routing::get, Router}; use tower_http::trace::TraceLayer; -use crate::state::{SharedState, State}; +use crate::state::SharedState; async fn root() -> &'static str { "Hello, hyperlog!" diff --git a/crates/hyperlog-server/src/internal_http.rs b/crates/hyperlog-server/src/internal_http.rs index 2dbe14e..6913d17 100644 --- a/crates/hyperlog-server/src/internal_http.rs +++ b/crates/hyperlog-server/src/internal_http.rs @@ -1,9 +1,9 @@ -use std::{net::SocketAddr, sync::Arc}; +use std::net::SocketAddr; use axum::{extract::MatchedPath, http::Request, routing::get, Router}; use tower_http::trace::TraceLayer; -use crate::state::{SharedState, State}; +use crate::state::SharedState; async fn root() -> &'static str { "Hello, hyperlog!" diff --git a/crates/hyperlog-server/src/querier.rs b/crates/hyperlog-server/src/querier.rs index cdd2cfe..50b4714 100644 --- a/crates/hyperlog-server/src/querier.rs +++ b/crates/hyperlog-server/src/querier.rs @@ -4,6 +4,7 @@ use crate::state::SharedState; pub struct Querier {} +#[allow(dead_code, unused_variables)] impl Querier { pub fn new() -> Self { Self {} diff --git a/crates/hyperlog-tui/src/lib.rs b/crates/hyperlog-tui/src/lib.rs index 3103a93..728ffc8 100644 --- a/crates/hyperlog-tui/src/lib.rs +++ b/crates/hyperlog-tui/src/lib.rs @@ -1,5 +1,6 @@ #![feature(map_try_insert)] #![feature(fn_traits)] +#![feature(let_chains)] use std::io::Stdout; @@ -109,52 +110,50 @@ async fn update<'a>( let mut handle_key_event = |maybe_event| -> anyhow::Result { match maybe_event { Some(Ok(e)) => { - if let Event::Key(key) = e { - if key.kind == KeyEventKind::Press { - let mut cmd = match &app.mode { - app::Mode::View => match key.code { - KeyCode::Enter => app.update(Msg::Interact)?, - KeyCode::Char('l') => app.update(Msg::MoveRight)?, - KeyCode::Char('h') => app.update(Msg::MoveLeft)?, - KeyCode::Char('j') => app.update(Msg::MoveDown)?, - KeyCode::Char('k') => app.update(Msg::MoveUp)?, - KeyCode::Char('a') => { - // TODO: batch commands - app.update(Msg::OpenCreateItemDialog)?; - app.update(Msg::EnterInsertMode)? - } - KeyCode::Char('i') => app.update(Msg::EnterInsertMode)?, - KeyCode::Char(':') => app.update(Msg::EnterCommandMode)?, - _ => return Ok(UpdateConclusion(false)), - }, - - app::Mode::Command | app::Mode::Insert => match key.code { - KeyCode::Backspace => app.update(Msg::Edit(EditMsg::Delete))?, - KeyCode::Enter => app.update(Msg::Edit(EditMsg::InsertNewLine))?, - KeyCode::Tab => app.update(Msg::Edit(EditMsg::InsertTab))?, - KeyCode::Delete => app.update(Msg::Edit(EditMsg::DeleteNext))?, - KeyCode::Char(c) => { - app.update(Msg::Edit(EditMsg::InsertChar(c)))? - } - KeyCode::Left => app.update(Msg::Edit(EditMsg::MoveLeft))?, - KeyCode::Right => app.update(Msg::Edit(EditMsg::MoveRight))?, - KeyCode::Esc => app.update(Msg::EnterViewMode)?, - _ => return Ok(UpdateConclusion(false)), - }, - }; - - loop { - let msg = cmd.into_command().execute(dispatch.clone()); - match msg { - Some(msg) => { - if let Msg::QuitApp = msg { - return Ok(UpdateConclusion(true)); - } - - cmd = app.update(msg)?; - } - None => break, + if let Event::Key(key) = e + && key.kind == KeyEventKind::Press + { + let mut cmd = match &app.mode { + app::Mode::View => match key.code { + KeyCode::Enter => app.update(Msg::Interact)?, + KeyCode::Char('l') => app.update(Msg::MoveRight)?, + KeyCode::Char('h') => app.update(Msg::MoveLeft)?, + KeyCode::Char('j') => app.update(Msg::MoveDown)?, + KeyCode::Char('k') => app.update(Msg::MoveUp)?, + KeyCode::Char('a') => { + // TODO: batch commands + app.update(Msg::OpenCreateItemDialog)?; + app.update(Msg::EnterInsertMode)? } + KeyCode::Char('i') => app.update(Msg::EnterInsertMode)?, + KeyCode::Char(':') => app.update(Msg::EnterCommandMode)?, + _ => return Ok(UpdateConclusion(false)), + }, + + app::Mode::Command | app::Mode::Insert => match key.code { + KeyCode::Backspace => app.update(Msg::Edit(EditMsg::Delete))?, + KeyCode::Enter => app.update(Msg::Edit(EditMsg::InsertNewLine))?, + KeyCode::Tab => app.update(Msg::Edit(EditMsg::InsertTab))?, + KeyCode::Delete => app.update(Msg::Edit(EditMsg::DeleteNext))?, + KeyCode::Char(c) => app.update(Msg::Edit(EditMsg::InsertChar(c)))?, + KeyCode::Left => app.update(Msg::Edit(EditMsg::MoveLeft))?, + KeyCode::Right => app.update(Msg::Edit(EditMsg::MoveRight))?, + KeyCode::Esc => app.update(Msg::EnterViewMode)?, + _ => return Ok(UpdateConclusion(false)), + }, + }; + + loop { + let msg = cmd.into_command().execute(dispatch.clone()); + match msg { + Some(msg) => { + if let Msg::QuitApp = msg { + return Ok(UpdateConclusion(true)); + } + + cmd = app.update(msg)?; + } + None => break, } } } diff --git a/crates/hyperlog-tui/src/querier/remote.rs b/crates/hyperlog-tui/src/querier/remote.rs index cdd4fdc..89a7764 100644 --- a/crates/hyperlog-tui/src/querier/remote.rs +++ b/crates/hyperlog-tui/src/querier/remote.rs @@ -5,12 +5,12 @@ use hyperlog_protos::hyperlog::{graph_client::GraphClient, graph_item::Contents, use itertools::Itertools; use tonic::transport::Channel; -use crate::shared_engine::SharedEngine; - +#[allow(dead_code)] pub struct Querier { channel: Channel, } +#[allow(dead_code, unused_variables)] impl Querier { pub async fn new() -> anyhow::Result { let channel = Channel::from_static("http://localhost:4000")