KeiSeiKit-1.0/_primitives/_rust/kei-gdrive-import/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

43 lines
1.1 KiB
Rust

use std::path::PathBuf;
use std::process::ExitCode;
use clap::Parser;
use kei_gdrive_import::cli::{Cli, Cmd};
use kei_gdrive_import::{classify, classify_remote, scan, scan_tree};
fn main() -> ExitCode {
let cli = Cli::parse();
let result = match cli.command {
Cmd::Classify { path, remote } => run_classify(&path, remote),
Cmd::ScanTree { root, remote } => run_scan(&root, remote),
};
match result {
Ok(json) => {
println!("{json}");
ExitCode::SUCCESS
}
Err(err) => {
eprintln!("kei-gdrive-import: {err:#}");
ExitCode::FAILURE
}
}
}
fn run_classify(path: &str, remote: bool) -> anyhow::Result<String> {
let c = if remote {
classify_remote(path)?
} else {
classify(&PathBuf::from(path))
};
Ok(serde_json::to_string_pretty(&c)?)
}
fn run_scan(root: &str, remote: bool) -> anyhow::Result<String> {
let entries = if remote {
scan::scan_remote(root)?
} else {
scan_tree(&PathBuf::from(root))?
};
Ok(serde_json::to_string_pretty(&entries)?)
}