Sort properties when steamosctl -a is used.

To make the output easier to parse as users sort by key.
This commit is contained in:
Jeremy Whiting 2024-04-29 22:44:56 -06:00
parent 8788e99245
commit 6e8e36b053
3 changed files with 20 additions and 1 deletions

16
Cargo.lock generated
View file

@ -338,6 +338,12 @@ dependencies = [
"crypto-common",
]
[[package]]
name = "either"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
[[package]]
name = "endi"
version = "1.1.0"
@ -563,6 +569,15 @@ dependencies = [
"libc",
]
[[package]]
name = "itertools"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
dependencies = [
"either",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -921,6 +936,7 @@ dependencies = [
"anyhow",
"clap",
"inotify",
"itertools",
"libc",
"nix",
"tempfile",

View file

@ -15,6 +15,7 @@ anyhow = "1"
clap = { version = "4.5", default-features = false, features = ["derive", "help", "std", "usage"] }
inotify = { version = "0.10", default-features = false, features = ["stream"] }
libc = "0.2"
itertools = "0.12"
nix = { version = "0.28", default-features = false, features = ["fs", "signal"] }
tokio = { version = "1", default-features = false, features = ["fs", "io-std", "io-util", "macros", "process", "rt-multi-thread", "signal", "sync"] }
tokio-stream = { version = "0.1", default-features = false }

View file

@ -7,6 +7,7 @@
use anyhow::Result;
use clap::{Parser, Subcommand};
use itertools::Itertools;
use std::ops::Deref;
use std::str::FromStr;
use steamos_manager::{ManagerProxy, WifiBackend};
@ -63,7 +64,8 @@ async fn main() -> Result<()> {
let properties = properties_proxy
.get_all(zvariant::Optional::from(Some(name)))
.await?;
for (key, value) in properties.iter() {
for key in properties.keys().sorted() {
let value = &properties[key];
let val = value.deref();
println!("{key}: {val}");
}