summaryrefslogtreecommitdiffstats
path: root/src/poem/anthology/source.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/poem/anthology/source.rs')
-rw-r--r--src/poem/anthology/source.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/poem/anthology/source.rs b/src/poem/anthology/source.rs
index ed4ed13..77d1330 100644
--- a/src/poem/anthology/source.rs
+++ b/src/poem/anthology/source.rs
@@ -12,7 +12,7 @@ use std::fs;
/// ```sh
/// source ~/.dwvshrc
/// ```
-pub fn incant(verse: &Verse, env: &mut Environment) -> i32 {
+pub fn incant(verse: &Verse, out: &mut String, env: &mut Environment) -> i32 {
let files = match verse.clause() {
Some(clause) => clause,
None => {
@@ -42,13 +42,15 @@ pub fn incant(verse: &Verse, env: &mut Environment) -> i32 {
}
};
- match poem.recite(env, None) {
- Ok(_) => {}
+ let stdout = if verse.couplet { Some(true) } else { None };
+
+ *out = match poem.recite(env, stdout) {
+ Ok(out) => out,
Err(e) => {
eprintln!("dwvsh: {}", e.to_string().to_lowercase());
continue;
}
- }
+ };
}
0