ls: fix table formatting a bit
This commit is contained in:
parent
d2a275be39
commit
511b32b320
|
@ -48,21 +48,25 @@ fn main() {
|
|||
let cli = <Cli as clap::Parser>::parse();
|
||||
|
||||
let fh = std::fs::File::open(&cli.file).expect("unable to open specified file");
|
||||
let data = unsafe { memmap2::MmapOptions::new().map(&fh).expect("unable to mmap specified file") };
|
||||
let data = unsafe {
|
||||
memmap2::MmapOptions::new()
|
||||
.map(&fh)
|
||||
.expect("unable to mmap specified file")
|
||||
};
|
||||
let data = &data[..];
|
||||
|
||||
match &cli.command {
|
||||
Command::Linear => {
|
||||
let ltr = yglnk_core::LinearTableRef::parse(data, cli.location)
|
||||
.expect("unable to parse table header");
|
||||
println!("name\ttyp\tlocation\tmeta\trest");
|
||||
println!("location\tmeta\t\tname\t\ttyp\t\trest");
|
||||
for i in ltr {
|
||||
print!(
|
||||
"{}\t{}\t{:08x}\t{:08x}\t",
|
||||
name_to_txt(i.name),
|
||||
typ_to_txt(i.typ),
|
||||
"{:08x}\t{:08x}\t{}\t{}\t",
|
||||
i.location,
|
||||
i.meta,
|
||||
name_to_txt(i.name),
|
||||
typ_to_txt(i.typ),
|
||||
);
|
||||
for j in i.rest {
|
||||
print!("{:02x}", j);
|
||||
|
@ -73,15 +77,15 @@ fn main() {
|
|||
Command::Hash => {
|
||||
let ht = yglnk_core::HashTableRef::parse(data, cli.location)
|
||||
.expect("unable to parse table header");
|
||||
println!("hash\tname\ttyp\tL\tR");
|
||||
println!("hash\tL\tR\tname\t\ttyp");
|
||||
for (hash, name, typ, val_l, val_r) in ht.iter() {
|
||||
println!(
|
||||
"{:016x}\t{}\t{}\t{:016x}\t{:016x}",
|
||||
"{:016x}\t{:016x}\t{:016x}\t{}\t{}",
|
||||
hash,
|
||||
name_to_txt(name),
|
||||
typ_to_txt(typ),
|
||||
val_l,
|
||||
val_r
|
||||
val_r,
|
||||
name_to_txt(name),
|
||||
typ_to_txt(typ)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue