mirror of
https://github.com/Llewellynvdm/exa.git
synced 2025-01-27 07:38:27 +00:00
Add more ls_colors colours
This commit is contained in:
parent
d517e9e12b
commit
bd8e9d819c
@ -71,18 +71,25 @@ impl Colours {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let scale = matches.has_where(|f| f.matches(&flags::COLOR_SCALE) || f.matches(&flags::COLOUR_SCALE))?;
|
let scale = matches.has_where(|f| f.matches(&flags::COLOR_SCALE) || f.matches(&flags::COLOUR_SCALE))?;
|
||||||
let mut c = Colours::colourful(scale.is_some());
|
let mut colours = Colours::colourful(scale.is_some());
|
||||||
|
|
||||||
if let Some(lsc) = vars.get("LS_COLORS") {
|
if let Some(lsc) = vars.get("LS_COLORS") {
|
||||||
let lsc = lsc.to_string_lossy();
|
let lsc = lsc.to_string_lossy();
|
||||||
let lsc = LSColors::parse(lsc.as_ref());
|
let lsc = LSColors::parse(lsc.as_ref());
|
||||||
|
|
||||||
if let Some(dir) = lsc.get("di") {
|
if let Some(c) = lsc.get("di") { colours.filekinds.directory = c; }
|
||||||
c.filekinds.directory = dir;
|
if let Some(c) = lsc.get("ex") { colours.filekinds.executable = c; }
|
||||||
}
|
if let Some(c) = lsc.get("fi") { colours.filekinds.normal = c; }
|
||||||
|
if let Some(c) = lsc.get("pi") { colours.filekinds.pipe = c; }
|
||||||
|
if let Some(c) = lsc.get("so") { colours.filekinds.socket = c; }
|
||||||
|
if let Some(c) = lsc.get("bd") { colours.filekinds.device = c; }
|
||||||
|
if let Some(c) = lsc.get("cd") { colours.filekinds.device = c; }
|
||||||
|
if let Some(c) = lsc.get("ln") { colours.filekinds.symlink = c; }
|
||||||
|
if let Some(c) = lsc.get("or") { colours.broken_arrow = c; }
|
||||||
|
if let Some(c) = lsc.get("mi") { colours.broken_filename = c; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(c)
|
Ok(colours)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,5 +277,14 @@ mod customs_test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test!(override_1: ls "di=34", exa "" => |c: &mut Colours| { c.filekinds.directory = Blue.normal(); });
|
test!(ls_di: ls "di=31", exa "" => |c: &mut Colours| { c.filekinds.directory = Red.normal(); }); // Directory
|
||||||
|
test!(ls_ex: ls "ex=32", exa "" => |c: &mut Colours| { c.filekinds.executable = Green.normal(); }); // Executable file
|
||||||
|
test!(ls_fi: ls "fi=33", exa "" => |c: &mut Colours| { c.filekinds.normal = Yellow.normal(); }); // Regular file
|
||||||
|
test!(ls_pi: ls "pi=34", exa "" => |c: &mut Colours| { c.filekinds.pipe = Blue.normal(); }); // FIFO
|
||||||
|
test!(ls_so: ls "so=35", exa "" => |c: &mut Colours| { c.filekinds.socket = Purple.normal(); }); // Socket
|
||||||
|
test!(ls_bd: ls "bd=36", exa "" => |c: &mut Colours| { c.filekinds.device = Cyan.normal(); }); // Block device
|
||||||
|
test!(ls_cd: ls "cd=35", exa "" => |c: &mut Colours| { c.filekinds.device = Purple.normal(); }); // Character device
|
||||||
|
test!(ls_ln: ls "ln=34", exa "" => |c: &mut Colours| { c.filekinds.symlink = Blue.normal(); }); // Symlink
|
||||||
|
test!(ls_or: ls "or=33", exa "" => |c: &mut Colours| { c.broken_arrow = Yellow.normal(); }); // Broken link
|
||||||
|
test!(ls_mi: ls "mi=32", exa "" => |c: &mut Colours| { c.broken_filename = Green.normal(); }); // Broken link target
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user