Site inventory mode
This commit is contained in:
parent
f0621c8bc8
commit
67a27284b3
12
src/main.rs
12
src/main.rs
@ -30,6 +30,7 @@ enum Session {
|
||||
#[derive(Debug, Clone, Subcommand)]
|
||||
enum Mode {
|
||||
Login,
|
||||
List,
|
||||
Status,
|
||||
Session {
|
||||
#[arg(default_value = "ongoing")]
|
||||
@ -161,6 +162,17 @@ fn main() -> Result<()> {
|
||||
|
||||
match args.mode {
|
||||
Mode::Login => login()?,
|
||||
Mode::List => {
|
||||
for site in ctx.sites_details()? {
|
||||
println!("Site {} (level {})", site.site.id, site.site.level_of_access);
|
||||
for circuit in site.circuits {
|
||||
println!(" Circuit {} ({}A)", circuit.id, circuit.rated_current);
|
||||
for charger in circuit.chargers {
|
||||
println!("Charger {} (level {}", charger.id, charger.level_of_access);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Mode::Status => loop_chargers(&mut ctx, &args.charger_id, |c, ctx| {
|
||||
c.state(ctx).map(|s| status(&c.id, s))
|
||||
})?,
|
||||
|
Loading…
Reference in New Issue
Block a user