From bd8c951dea81692f71b3fd0e891e498d1392e5e7 Mon Sep 17 00:00:00 2001 From: Arnav Singh Date: Thu, 6 Jun 2019 16:09:06 -0700 Subject: [PATCH] Sort `iotedge list` output by module name Fixes #1192 --- edgelet/iotedge/src/list.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/edgelet/iotedge/src/list.rs b/edgelet/iotedge/src/list.rs index 36e254f4e51..2f5587de913 100644 --- a/edgelet/iotedge/src/list.rs +++ b/edgelet/iotedge/src/list.rs @@ -49,7 +49,9 @@ where .list_with_details() .map_err(|err| Error::from(err.context(ErrorKind::ModuleRuntime))) .collect() - .and_then(move |result| { + .and_then(move |mut result| { + result.sort_by(|(mod1, _), (mod2, _)| mod1.name().cmp(mod2.name())); + let mut w = write.lock().unwrap(); writeln!(w, "NAME\tSTATUS\tDESCRIPTION\tCONFIG") .context(ErrorKind::WriteToStdout)?;