create Palette trait (#1813)

* create Pallet trait

* correct spelling to palette

* move palette to it's own module
This commit is contained in:
Kurtis
2020-05-17 10:48:57 -07:00
committed by GitHub
parent e728cecb4d
commit d4dd8284a6
4 changed files with 87 additions and 43 deletions

View File

@ -263,6 +263,7 @@ pub fn get_help(cmd: &dyn WholeStreamCommand, registry: &CommandRegistry) -> Str
}
}
let palette = crate::shell::palette::DefaultPalette {};
let examples = cmd.examples();
if !examples.is_empty() {
long_desc.push_str("\nExamples:");
@ -272,7 +273,7 @@ pub fn get_help(cmd: &dyn WholeStreamCommand, registry: &CommandRegistry) -> Str
long_desc.push_str(" ");
long_desc.push_str(example.description);
let colored_example =
crate::shell::helper::Painter::paint_string(example.example, registry);
crate::shell::helper::Painter::paint_string(example.example, registry, &palette);
long_desc.push_str(&format!("\n > {}\n", colored_example));
}