Files
garandos-tui/src/cli.rs
GarandPLG 6c50da8c18 Refactor Nix handling and add toggle UI
- Introduce `NixModules` struct containing file paths, parsed ASTs, and
option lists. - Add `parse_nix` and `build_nix_modules` helpers for
centralized parsing. - Update CLI to use `build_nix_modules` instead of
manual parsing. - Extend `App` with system/home paths and ASTs, enabling
in‑place editing. - Implement boolean toggle on Enter: update AST,
rewrite file, refresh modules, and report action. - Simplify event
handling, adding shortcuts `1`/`2` to switch files. - Revise UI layout,
introduce footer with usage hints and last‑action status. - Adjust
imports and remove obsolete code across modules.
2025-12-06 17:21:44 +01:00

30 lines
721 B
Rust

use crate::nix::{NixModules, build_nix_modules};
use clap::Parser;
use std::path::PathBuf;
#[derive(Parser, Debug)]
#[command(
version,
about = "Potrzebne pliki znajdziesz w ~/garandos/hosts/<Twój-Host>/",
long_about = "Potrzebne pliki znajdziesz w ~/garandos/hosts/<Twój-Host>/"
)]
pub struct Cli {
#[arg(
long,
help = "Ścieżka do pliku system-modules.nix",
value_name = "SYSTEM_MODULES"
)]
pub sf: PathBuf,
#[arg(
long,
help = "Ścieżka do pliku home-modules.nix",
value_name = "HOME_MODULES"
)]
pub hf: PathBuf,
}
pub fn get_modules() -> NixModules {
let args: Cli = Cli::parse();
build_nix_modules(args.sf, args.hf)
}