- 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.
30 lines
721 B
Rust
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)
|
|
}
|