feat: add logging for tui

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-05-01 22:17:39 +02:00
parent 5327aff217
commit 1885a200c4
12 changed files with 600 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ edition = "2021"
[dependencies]
hyperlog-core.workspace = true
hyperlog-tui.workspace = true
anyhow.workspace = true
tokio.workspace = true
@@ -15,7 +16,13 @@ dotenv.workspace = true
axum.workspace = true
serde = { version = "1.0.197", features = ["derive"] }
sqlx = { version = "0.7.3", features = ["runtime-tokio", "tls-rustls", "postgres", "uuid", "time"] }
sqlx = { version = "0.7.3", features = [
"runtime-tokio",
"tls-rustls",
"postgres",
"uuid",
"time",
] }
uuid = { version = "1.7.0", features = ["v4"] }
tower-http = { version = "0.5.2", features = ["cors", "trace"] }
serde_json = "1.0.116"

View File

@@ -0,0 +1,77 @@
hyperlog
--------
kjuulh:
- (summary: items(10)) -> projects/**
- [ ] wash the dishes
...
- project A
- sub project B (items: 10)
...
- sub project C (items: 0)
- project B
- sub project A
- project C
- sub project A
- project D
- sub project A
---
Traversing into the nested section
hyperlog
--------
kjuulh:
- (summary: items(10)) -> projects/**
- **project A**
- sub project B (items: 10)
- [ ] Something
- [ ] Something B (High priority, due wednesday)
- [ ] Something C
...
- sub project C (items: 0)
- [ ] Something
- [ ] Something B (High priority, due wednesday)
- [ ] Something C
- [ ] Something D
- [ ] Something E
...
- project B
---
Traversing into the final section
hyperlog
--------
- **project A**
- **sub project B (items: 10)**
- [ ] Something
- [ ] Something B (High priority, due wednesday)
- [ ] Something C
- [ ] Something E
- [ ] Something D
- sub project C (items: 0)
...

View File

@@ -6,7 +6,7 @@ use hyperlog_core::{commander, state};
use crate::server::serve;
#[derive(Parser)]
#[command(author, version, about, long_about = None, subcommand_required = true)]
#[command(author, version, about, long_about = None)]
struct Command {
#[command(subcommand)]
command: Option<Commands>,
@@ -27,6 +27,8 @@ enum Commands {
commands: QueryCommands,
},
Info {},
ClearLock {},
}
#[derive(Subcommand)]
@@ -59,6 +61,10 @@ enum QueryCommands {
pub async fn execute() -> anyhow::Result<()> {
let cli = Command::parse();
if cli.command.is_some() {
tracing_subscriber::fmt::init();
}
let state = state::State::new()?;
match cli.command {
@@ -100,8 +106,13 @@ pub async fn execute() -> anyhow::Result<()> {
Some(Commands::Info {}) => {
println!("graph stored at: {}", state.storage.info()?)
}
None => {}
Some(Commands::ClearLock {}) => {
state.storage.clear_lock_file();
println!("cleared lock file");
}
None => {
hyperlog_tui::execute(&state).await?;
}
}
Ok(())

View File

@@ -5,7 +5,6 @@ pub(crate) mod state;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();
tracing_subscriber::fmt::init();
cli::execute().await?;