Skip to content

Commit

Permalink
disable terminal user interface
Browse files Browse the repository at this point in the history
  • Loading branch information
keinsell committed Feb 10, 2025
1 parent 94b46d0 commit 1875cfc
Show file tree
Hide file tree
Showing 11 changed files with 337 additions and 266 deletions.
154 changes: 34 additions & 120 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ sea-orm-migration = { version = "1.1.0", features = [
serde_json = "1.0.134"
owo-colors = "4.1.0"
chrono-humanize = "0.2.3"
ratatui = "0.26.1"
crossterm = "0.27.0"
async-trait = "0.1.85"
indicatif = "0.17.9"
tracing-subscriber = "0.3.18"
Expand All @@ -72,13 +70,10 @@ tracing = "0.1.40"
predicates = "3.1.3"
serde_derive = "1.0.217"
thiserror = "2.0.11"
ratatui-textarea = "0.4.1"
regex = "1.11.1"
cached = {version = "0.54.0", features = ["disk_store", "async"]}
derive_more = {version = "1.0.0", features = ["full"]}
strum = "0.26.3"
human-panic = "2.0.2"
crossbeam = { version = "0.8.4", features = ["crossbeam-channel"] }
uuid = { version = "1.12.1", features = ["v4"] }
etcetera = "0.8.0"
tracing-appender = "0.2.3"
Expand All @@ -89,11 +84,11 @@ pretty_env_logger = "0.5.0"
textplots = "0.8.6"
valuable = "0.1.1"
derive = "1.0.0"
console = "0.15"
terminal-link = "0.1"
crossterm = "0.28.1"
ratatui = "0.29.0"

[features]
default = ["tui"]
default = []
tui = []

[expand]
Expand Down
4 changes: 4 additions & 0 deletions docs/tui/terminal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Header Bar: Displays the application title, version, and system status (like current date/time).
Navigation Sidebar / Tab Bar: Allows users to switch between different views (Dashboard, Medications, History, Alerts, Settings).
Main Content Area: The primary region for displaying dosage schedules, logs, or forms.
Footer / Status Bar: Shows context-sensitive hints, key bindings, and error or status messages.
19 changes: 13 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use clap::Parser;
use core::CommandHandler;
use miette::Result;
use std::env;

use tracing_subscriber::util::SubscriberInitExt;

mod cli;
mod core;
Expand All @@ -41,14 +41,21 @@ async fn main() -> Result<()>
// https://apple.github.io/swift-argument-parser/documentation/argumentparser/installingcompletionscripts/
// https://unix.stackexchange.com/a/605051

let no_args_provided = env::args().len() == 1;
let is_interactive_terminal = atty::is(Stream::Stdout);

if no_args_provided && is_interactive_terminal
#[cfg(feature = "tui")]
{
return tui::tui().await.map_err(|e| miette::miette!(e.to_string()));
let no_args_provided = env::args().len() == 1;
let is_interactive_terminal = atty::is(Stream::Stdout);

if no_args_provided && is_interactive_terminal
{
let terminal = tui::init()?;
let result = tui::run(terminal);
tui::restore()?;
return result;
}
}


let cli = Cli::parse();

let context = AppContext {
Expand Down
Loading

0 comments on commit 1875cfc

Please sign in to comment.