mirror of
https://github.com/bahdotsh/wrkflw.git
synced 2026-09-01 19:50:23 +02:00
refactor(ui): feature-gate models and utils, clean up cfg imports
The previous commit gated the TUI behind a feature flag but left the models and utils modules unconditionally compiled. It turns out that *every single consumer* of those modules is TUI-gated code — they were compiling to dead code when building with --no-default-features. Gate models and utils behind cfg(feature = "tui") where they belong. While at it, consolidate the five separate #[cfg(feature = "tui")] annotations on imports in workflow.rs into a single grouped use block, because repeating the same attribute five times in a row is not my idea of readability. Also add a cargo check --no-default-features step to CI so this kind of thing doesn't silently regress.
This commit is contained in:
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -52,6 +52,12 @@ jobs:
|
||||
command: build
|
||||
args: --target ${{ matrix.target }}
|
||||
|
||||
- name: Check no-default-features
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --no-default-features --target ${{ matrix.target }}
|
||||
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
// Workflow handlers
|
||||
#[cfg(feature = "tui")]
|
||||
use crate::app::App;
|
||||
#[cfg(feature = "tui")]
|
||||
use crate::models::{ExecutionResultMsg, WorkflowExecution, WorkflowStatus};
|
||||
#[cfg(feature = "tui")]
|
||||
use chrono::Local;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
#[cfg(feature = "tui")]
|
||||
use std::sync::mpsc;
|
||||
#[cfg(feature = "tui")]
|
||||
use std::thread;
|
||||
use wrkflw_evaluator::evaluate_workflow_file;
|
||||
use wrkflw_executor::{self, JobStatus, RuntimeType, StepStatus};
|
||||
#[cfg(feature = "tui")]
|
||||
use {
|
||||
crate::app::App,
|
||||
crate::models::{ExecutionResultMsg, WorkflowExecution, WorkflowStatus},
|
||||
chrono::Local,
|
||||
std::sync::mpsc,
|
||||
std::thread,
|
||||
};
|
||||
|
||||
// Validate a workflow or directory containing workflows
|
||||
pub fn validate_workflow(path: &Path, verbose: bool) -> io::Result<()> {
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
// - utils: Contains utility functions
|
||||
// - views: Contains UI rendering code
|
||||
|
||||
// Re-export public modules
|
||||
// Always-available modules (CLI validation/execution)
|
||||
pub mod handlers;
|
||||
pub mod models;
|
||||
pub mod utils;
|
||||
|
||||
// TUI-specific modules (require ratatui/crossterm)
|
||||
#[cfg(feature = "tui")]
|
||||
@@ -21,6 +19,10 @@ pub mod components;
|
||||
#[cfg(feature = "tui")]
|
||||
pub mod log_processor;
|
||||
#[cfg(feature = "tui")]
|
||||
pub mod models;
|
||||
#[cfg(feature = "tui")]
|
||||
pub mod utils;
|
||||
#[cfg(feature = "tui")]
|
||||
pub mod views;
|
||||
|
||||
// Re-export main entry points
|
||||
|
||||
Reference in New Issue
Block a user