aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/main.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-05 19:30:00 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-05 19:30:00 -0800
commitb4516220b95743b485b9bcd8226285255be9c9c4 (patch)
tree389d17e14b012c64f57a0947257d298ebea29789 /nitrocli/src/main.rs
parent6d07a0c9d9a9b39247a9727dea2d90eba4e1fe9e (diff)
downloadnitrocli-b4516220b95743b485b9bcd8226285255be9c9c4.tar.gz
nitrocli-b4516220b95743b485b9bcd8226285255be9c9c4.tar.bz2
Emit all output to custom stdio channels
This change continues and concludes the effort of using customizable stdio channels for output of data from the program. It does so by replacing the standard println macro with a custom one that outputs the data to the supplied context's stdout object. Because this object is injected from the main function, it will be possible for tests invoking this function to supply custom Write objects that can buffer this data and make it available for verification purposes.
Diffstat (limited to 'nitrocli/src/main.rs')
-rw-r--r--nitrocli/src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/nitrocli/src/main.rs b/nitrocli/src/main.rs
index ad79c6e..2425562 100644
--- a/nitrocli/src/main.rs
+++ b/nitrocli/src/main.rs
@@ -68,6 +68,9 @@
//! Nitrocli is a program providing a command line interface to certain
//! commands of Nitrokey Pro and Storage devices.
+#[macro_use]
+mod redefine;
+
mod args;
mod commands;
mod error;
@@ -101,7 +104,7 @@ fn run<'ctx, 'io: 'ctx>(ctx: &'ctx mut RunCtx<'io>, args: Vec<String>) -> i32 {
_ => 1,
},
_ => {
- println!("{}", err);
+ let _ = eprintln!(ctx, "{}", err);
1
}
},