KeiSeiKit-1.0/_primitives/_rust/kei-projects-index/src/main.rs
Parfii-bot a4e667de10 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

56 lines
1.3 KiB
Rust

//! kei-projects-index — CLI dispatcher.
//!
//! Constructor Pattern: this binary holds clap shapes only. Every command
//! forwards to a function in the sibling `cli` / `query` cubes or to
//! `kei_projects_index::*` library APIs.
use clap::{Parser, Subcommand};
use std::path::PathBuf;
use std::process::ExitCode;
mod cli;
#[derive(Parser)]
#[command(name = "kei-projects-index", version, about = "SQLite index of ~/Projects/")]
struct Cli {
#[command(subcommand)]
cmd: Cmd,
}
#[derive(Subcommand)]
enum Cmd {
/// Create the DB file and apply the schema.
Init {
#[arg(long)]
db: Option<PathBuf>,
},
/// Walk projects_root and refresh every row.
Rebuild {
#[arg(long)]
db: Option<PathBuf>,
#[arg(long)]
root: Option<PathBuf>,
},
/// Print all rows as a JSON array to stdout.
List {
#[arg(long)]
db: Option<PathBuf>,
},
/// Print one project row as JSON.
Get {
#[arg(long)]
db: Option<PathBuf>,
#[arg(long)]
path: String,
},
}
fn main() -> ExitCode {
let cli = Cli::parse();
match cli.cmd {
Cmd::Init { db } => cli::cmd_init(db),
Cmd::Rebuild { db, root } => cli::cmd_rebuild(db, root),
Cmd::List { db } => cli::cmd_list(db),
Cmd::Get { db, path } => cli::cmd_get(db, path),
}
}