-
Notifications
You must be signed in to change notification settings - Fork 13
Make code organization match the functional structure #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/app/handlers/mod.rs
Outdated
@@ -35,7 +35,7 @@ use tonic::transport::Channel; | |||
|
|||
use crate::{ | |||
app::{state::tabs::history::HistoryQuery, AppEvent}, | |||
ui::SelectedTab, | |||
tui::SelectedTab, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed ui
to tui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wont have time for a full review right now, but as a drive by comment i think what would align more to the structure i have in mind is renaming app
to tui
. The ui
code is actual display code for the tui
app (i.e. it is ratatui
widgets like Table
, Textarea
, Paragraph
, etc.). i can imagine having a directory structure something like this:
tui/state
tui/handlers
tui/ui
cli/...
execution/...
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call -- done in 9ea59d6
@@ -88,15 +80,14 @@ pub struct App<'app> { | |||
} | |||
|
|||
impl<'app> App<'app> { | |||
pub fn new(state: state::AppState<'app>, cli: DftCli) -> Self { | |||
pub fn new(state: state::AppState<'app>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cli arguments don't appear to be used after construction so I removed them from the structures
@@ -329,118 +320,3 @@ pub async fn run_app(cli: cli::DftCli, state: state::AppState<'_>) -> Result<()> | |||
} | |||
app.exit() | |||
} | |||
|
|||
/// Encapsulates the command line interface | |||
pub struct CliApp { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved into cli
|
||
use clap::Parser; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the CLI parsing into main.rs
Update: moved into args.rs
src/main.rs
Outdated
} | ||
|
||
Ok(()) | ||
} | ||
|
||
const LONG_ABOUT: &str = " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesnt need to be in this PR but maybe we put all of the clap logic in something like args.rs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 5e88d0a
I had to get the PR checked out to fix the formatting, so I went ahead and made the changes you suggested While I was at it, I also noticed that the |
part of #132
We are moving
dft
so there is an engine and 2 uis (the terminal tui and the cli)Let's make the code structure match this functional structure:
ui
totui
to make it clear it is the terminal uiDftArgs
in in main.rsI don't fully understand the split between what logic belongs in
app
and what belongs intui
but I figure we can work on that split over time