diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/poem/anthology/alias.rs | 4 | ||||
-rw-r--r-- | src/poem/anthology/export.rs | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/poem/anthology/alias.rs b/src/poem/anthology/alias.rs index 248342e..511bd3a 100644 --- a/src/poem/anthology/alias.rs +++ b/src/poem/anthology/alias.rs @@ -1,4 +1,5 @@ use crate::poem::Verse; +use std::collections::BTreeMap; use std::collections::HashMap; /// alias @@ -23,7 +24,8 @@ pub fn incant(verse: &Verse, out: &mut Vec<u8>, aliases: &mut HashMap<String, St } None => { let mut lines = Vec::new(); - for (key, val) in aliases { + let sorted: BTreeMap<_, _> = aliases.into_iter().collect(); + for (key, val) in sorted { let line = if key.contains(' ') && val.contains(' ') { format!("'{}'='{}'", key, val) } else if key.contains(' ') { diff --git a/src/poem/anthology/export.rs b/src/poem/anthology/export.rs index dfbaf81..aa5a894 100644 --- a/src/poem/anthology/export.rs +++ b/src/poem/anthology/export.rs @@ -1,4 +1,5 @@ use crate::poem::Verse; +use std::collections::BTreeMap; use std::env; /// export @@ -26,7 +27,8 @@ pub fn incant(verse: &Verse) -> i32 { } } None => { - for (key, val) in env::vars() { + let sorted: BTreeMap<_, _> = env::vars().into_iter().collect(); + for (key, val) in sorted { println!("{}={}", key, val); } } |