diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-06-11 21:23:22 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-06-11 21:23:22 +0100 |
commit | bc767e9de9d161ef1293349288593799f4ba9001 (patch) | |
tree | b01d04378d5f6682975b45dbbe1550047934db48 | |
parent | 8f729f785d324735bd451b5cb142f7b107386230 (diff) | |
download | subplot-bc767e9de9d161ef1293349288593799f4ba9001.tar.gz |
cli: Sort output of metadata command
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r-- | src/bin/cli/mod.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/bin/cli/mod.rs b/src/bin/cli/mod.rs index f3225db..6d643ba 100644 --- a/src/bin/cli/mod.rs +++ b/src/bin/cli/mod.rs @@ -41,40 +41,46 @@ pub struct Metadata { impl TryFrom<&mut Document> for Metadata { type Error = subplot::SubplotError; fn try_from(doc: &mut Document) -> std::result::Result<Self, Self::Error> { - let sources: Vec<_> = doc + let mut sources: Vec<_> = doc .sources() .into_iter() .map(|p| filename(Some(&p))) .collect(); + sources.sort_unstable(); let title = doc.meta().title().to_owned(); - let binding_files = doc + let mut binding_files: Vec<_> = doc .meta() .bindings_filenames() .into_iter() .map(|p| filename(Some(&p))) .collect(); - let function_files = doc + binding_files.sort_unstable(); + let mut function_files: Vec<_> = doc .meta() .functions_filenames() .into_iter() .map(|p| filename(Some(&p))) .collect(); - let bibliographies = doc + function_files.sort_unstable(); + let mut bibliographies: Vec<_> = doc .meta() .bibliographies() .into_iter() .map(|p| filename(Some(&p))) .collect(); - let scenarios = doc + bibliographies.sort_unstable(); + let mut scenarios: Vec<_> = doc .scenarios()? .into_iter() .map(|s| s.title().to_owned()) .collect(); - let files = doc + scenarios.sort_unstable(); + let mut files: Vec<_> = doc .files() .iter() .map(|f| f.filename().to_owned()) .collect(); + files.sort_unstable(); Ok(Self { sources, title, |