diff options
author | Daniel Schadt <kingdread@gmx.de> | 2019-12-12 00:55:55 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2019-12-12 00:55:55 +0100 |
commit | 5350b4ece04082bf8a0a127c230669c4de9b7cc4 (patch) | |
tree | d93af30af28280809a606f4f5c0b769742ff1077 /src/output.rs | |
parent | c86752e39dd015aa66c741be3e2312c6f0e69ef1 (diff) | |
download | kondou-5350b4ece04082bf8a0a127c230669c4de9b7cc4.tar.gz kondou-5350b4ece04082bf8a0a127c230669c4de9b7cc4.tar.bz2 kondou-5350b4ece04082bf8a0a127c230669c4de9b7cc4.zip |
add some more doc comments
Diffstat (limited to 'src/output.rs')
-rw-r--r-- | src/output.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/output.rs b/src/output.rs index 2a2546f..f6e9bc4 100644 --- a/src/output.rs +++ b/src/output.rs @@ -1,3 +1,4 @@ +//! Functions for console output. use super::{ api, bt::{BuildTemplate, Traitline}, @@ -7,6 +8,9 @@ use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; const HEADER_COLOR: Color = Color::Cyan; +/// Format a skill for displaying. +/// +/// This is just the skill name (if given). fn format_skill(skill: &Option<api::Skill>) -> String { match *skill { None => "none".to_owned(), @@ -14,6 +18,7 @@ fn format_skill(skill: &Option<api::Skill>) -> String { } } +/// Format a traitline for displaying. fn format_traitline(traitline: &Option<Traitline>) -> String { match *traitline { None => "none".to_owned(), @@ -24,6 +29,7 @@ fn format_traitline(traitline: &Option<Traitline>) -> String { } } +/// Show a build template to the standard output stream. pub fn show_build_template(build: &BuildTemplate) -> io::Result<()> { let mut stdout = StandardStream::stdout(ColorChoice::Auto); let mut color_spec = ColorSpec::new(); @@ -58,6 +64,9 @@ pub fn show_build_template(build: &BuildTemplate) -> io::Result<()> { Ok(()) } +/// Show an error to the standard error stream. +/// +/// This will also show the chain of errors that lead up to this error, if available. pub fn show_error<E: Error + ?Sized>(error: &E) -> io::Result<()> { let mut error_color = ColorSpec::new(); error_color.set_fg(Some(Color::Red)); |