refactor(naming): A1 — ente→arje, vista→revista, pluma→fana
Rename batch de la Fase A del PLAN_MACRO: - 25 crates ente-* → arje-* (protocol/init/runtime/compat). El linaje arje (init Linux) queda con prefijo coherente. - vista → revista (revista-core + revista-web). - pluma → fana (fana-md + fana-md-reader-web). fana absorbe el linaje markdown de pluma; será el writer DAG editor (prioridad alta). Cambios: - git mv de 29 crate dirs + 2 SDDs - package/lib/bin names + path refs + imports .rs reescritos - workspace Cargo.toml + comentarios de sección - SDDs de init/runtime/compat/protocol actualizados a arje- - SDD de revista + SDD de fana (reescrito: writer DAG editor) - docs/STATUS.md, ROADMAP.md, PLAN_MACRO.md, arje-boot.md, arje-replace-systemd.md actualizados - docs/changelog/akasha.md → chasqui.md scripts/rename-fase-a.py idempotente (--dry-run soportado). cargo check --workspace verde. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
//! busctl: cliente CLI para el bus interno del fractal.
|
||||
//!
|
||||
//! Uso:
|
||||
//! cargo run --example busctl -- list-entes
|
||||
//! cargo run --example busctl -- announce
|
||||
//! cargo run --example busctl -- power-off
|
||||
//!
|
||||
//! Si `ENTE_BUS_SOCK` no está en el entorno, cae al path dev por defecto.
|
||||
|
||||
use arje_bus::{BusClient, BusRequest};
|
||||
use std::env;
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let cmd = args.get(1).map(|s| s.as_str()).unwrap_or("list-entes");
|
||||
|
||||
let mut client = match BusClient::from_env().await {
|
||||
Ok(c) => c,
|
||||
Err(_) => {
|
||||
let user = env::var("USER").unwrap_or_else(|_| "ente".into());
|
||||
let runtime = env::var("XDG_RUNTIME_DIR")
|
||||
.unwrap_or_else(|_| env::var("TMPDIR").unwrap_or_else(|_| "/tmp".into()));
|
||||
let path = format!("{runtime}/ente-bus-{user}.sock");
|
||||
eprintln!("ENTE_BUS_SOCK no definido, intentando {path}");
|
||||
BusClient::connect(&path).await?
|
||||
}
|
||||
};
|
||||
|
||||
let req = match cmd {
|
||||
"list-entes" => BusRequest::ListEntes,
|
||||
"announce" => BusRequest::Announce { capabilities: vec![] },
|
||||
"power-off" => BusRequest::PowerOff { interactive: false },
|
||||
"reboot" => BusRequest::Reboot { interactive: false },
|
||||
"suspend" => BusRequest::Suspend { interactive: false },
|
||||
"invoke-echo" => {
|
||||
let msg = args.get(2).map(|s| s.as_str()).unwrap_or("hola");
|
||||
BusRequest::Invoke {
|
||||
cap: arje_echo::echo_capability(),
|
||||
blob: msg.as_bytes().to_vec(),
|
||||
}
|
||||
}
|
||||
other => {
|
||||
eprintln!("subcomando desconocido: {other}");
|
||||
eprintln!("válidos: list-entes, announce, power-off, reboot, suspend, invoke-echo <text>");
|
||||
std::process::exit(2);
|
||||
}
|
||||
};
|
||||
let resp = client.call(req).await?;
|
||||
println!("{resp:#?}");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user