mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-13 13:42:34 +00:00
args/inode: 🔨 inode work with long
This commit is contained in:
parent
74660f1d70
commit
7ca7290e23
3 changed files with 13 additions and 4 deletions
|
@ -215,8 +215,7 @@ pub fn build() -> App<'static, 'static> {
|
|||
.short("i")
|
||||
.long("inode")
|
||||
.multiple(true)
|
||||
.conflicts_with("blocks")
|
||||
.help("Display inode and file names"),
|
||||
.help("Display inode(Linux only)"),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -98,8 +98,7 @@ impl Flags {
|
|||
None => usize::max_value(),
|
||||
};
|
||||
|
||||
let blocks: Vec<Block> = match () {
|
||||
_ if inode => vec![Block::INode, Block::Name],
|
||||
let mut blocks: Vec<Block> = match () {
|
||||
_ if !blocks_inputs.is_empty() => blocks_inputs.into_iter().map(Block::from).collect(),
|
||||
_ if matches.is_present("long") => vec![
|
||||
Block::Permission,
|
||||
|
@ -112,6 +111,11 @@ impl Flags {
|
|||
_ => vec![Block::Name],
|
||||
};
|
||||
|
||||
// Add inode as first column if with inode flag
|
||||
if inode && !blocks.contains(&Block::INode) {
|
||||
blocks.insert(0, Block::INode);
|
||||
}
|
||||
|
||||
let mut ignore_globs_builder = GlobSetBuilder::new();
|
||||
for pattern in ignore_globs_inputs {
|
||||
let glob = match Glob::new(pattern) {
|
||||
|
|
|
@ -128,6 +128,12 @@ fn test_list_block_inode_populated_directory() {
|
|||
.stdout(predicate::str::is_match(matched).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_list_inode_with_long_ok() {
|
||||
let dir = tempdir();
|
||||
cmd().arg("-i").arg("-l").arg(dir.path()).assert().success();
|
||||
}
|
||||
|
||||
fn cmd() -> Command {
|
||||
Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue