v0.2.14 : barres verticales des cadres aux couleurs du theme + commande theme dans le shell (theme liste les themes, theme <name> change a chaud, completion et menu synchronises)
This commit is contained in:
+26
-2
@@ -508,6 +508,23 @@ pub static HELP_SPECS: &[HelpSpec] = &[
|
||||
HelpExample { desc: "Show version and build information.", code: "version" },
|
||||
],
|
||||
},
|
||||
HelpSpec {
|
||||
name: "theme",
|
||||
category: "Shell",
|
||||
usage: "theme {flags} [name]",
|
||||
about: "Show the color themes, or switch the active one inside the shell.",
|
||||
search_terms: &["color", "colors", "palette"],
|
||||
flags: &[],
|
||||
subcommands: &[],
|
||||
parameters: &[
|
||||
HelpParam { name: "name", typ: "string", desc: "Theme to switch to (default, ocean, sunset, forest, dracula, mono); omit to list them" },
|
||||
],
|
||||
io: None,
|
||||
examples: &[
|
||||
HelpExample { desc: "List the available themes.", code: "theme" },
|
||||
HelpExample { desc: "Switch to the ocean theme.", code: "theme ocean" },
|
||||
],
|
||||
},
|
||||
HelpSpec {
|
||||
name: "ls",
|
||||
category: "Shell",
|
||||
@@ -751,8 +768,15 @@ fn io_table(input: &str, output: &str, theme: &Theme, color: bool) -> String {
|
||||
line
|
||||
}
|
||||
};
|
||||
let bar = |s: &str| -> String {
|
||||
if color {
|
||||
theme.frame(s)
|
||||
} else {
|
||||
s.to_string()
|
||||
}
|
||||
};
|
||||
let row = |cells: &[&str], bold: bool| -> String {
|
||||
let mut line = String::from("│");
|
||||
let mut line = bar("│");
|
||||
for (i, c) in cells.iter().enumerate() {
|
||||
line.push(' ');
|
||||
let text = if bold {
|
||||
@@ -767,7 +791,7 @@ fn io_table(input: &str, output: &str, theme: &Theme, color: bool) -> String {
|
||||
line.push_str(&text);
|
||||
line.push_str(&" ".repeat(widths[i] - c.chars().count()));
|
||||
line.push(' ');
|
||||
line.push('│');
|
||||
line.push_str(&bar("│"));
|
||||
}
|
||||
line
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user