Skip to content

Commit

Permalink
fix(): Replace Colorizer with HelpWriter::String
Browse files Browse the repository at this point in the history
  • Loading branch information
ychiguer committed Jun 28, 2022
1 parent 68c701b commit 99509c3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/builder/command.rs
Expand Up @@ -720,12 +720,11 @@ impl<'help> App<'help> {
/// ```
pub fn render_help(&mut self) -> String {
self._build_self();
let color = self.get_color();

let mut c = Colorizer::new(Stream::Stdout, color);
let mut help: String = "".into();
let usage = Usage::new(self);
match Help::new(HelpWriter::Buffer(&mut c), self, &usage, false).write_help() {
Ok(_) => c.to_owned().to_string(),
match Help::new(HelpWriter::String(&mut help), self, &usage, false).write_help() {
Ok(_) => help,
Err(e) => {
panic!("{}", e.to_string())
}
Expand All @@ -744,12 +743,11 @@ impl<'help> App<'help> {
/// ```
pub fn render_long_help(&mut self) -> String {
self._build_self();
let color = self.get_color();

let mut c = Colorizer::new(Stream::Stdout, color);
let mut help: String = "".into();
let usage = Usage::new(self);
match Help::new(HelpWriter::Buffer(&mut c), self, &usage, true).write_help() {
Ok(_) => c.to_owned().to_string(),
match Help::new(HelpWriter::String(&mut help), self, &usage, true).write_help() {
Ok(_) => help,
Err(e) => {
panic!("{}", e.to_string())
}
Expand Down

0 comments on commit 99509c3

Please sign in to comment.