Skip to content

Misaligned output when using certain flags #32

@jahndan

Description

@jahndan

This tool seems great so far (I can finally replace my scuffed fd/tree shell function), but I just ran into these behaviors which I'm assuming are bugs:

When using the -p to display permissions, it only prints permissions for nodes under the specified directory, but not the specified directory itself. This yields misaligned output with the specified directory's name and the branches in the following lines.

Expected output:

drwxr-xr-x .
-rw-r--r-- └── Makefile
-rw-r--r-- └── TODO.md
drwxr-xr-x └── build
-rwxr-xr-x     └── kilo
drwxr-xr-x     └── src
-rw-r--r--         └── main.c.d
-rw-r--r--         └── main.c.o
drwxr-xr-x └── src
-rw-r--r--     └── main.c

3 directories, 6 files

Actual output:

.
-rw-r--r-- └── Makefile
-rw-r--r-- └── TODO.md
drwxr-xr-x └── build
-rwxr-xr-x     └── kilo
drwxr-xr-x     └── src
-rw-r--r--         └── main.c.d
-rw-r--r--         └── main.c.o
drwxr-xr-x └── src
-rw-r--r--     └── main.c

3 directories, 6 files

Similar things happen with the -G flag, where all but the specified directory are prefixed with a space:

Expected:

lstr % touch grass
lstr % lstr -G
  .
  └── Cargo.toml
  └── flake.lock
  └── rustfmt.toml
  └── LICENSE
  └── CHANGELOG.md
  └── tests
      └── cli.rs
  └── Cargo.lock
  └── README.md
  └── flake.nix
? └── grass
  └── assets
      └── demo.tape
      └── lstr-demo.gif
  └── src
      └── icons.rs
      └── git.rs
      └── main.rs
      └── app.rs
      └── tui.rs
      └── utils.rs
      └── view.rs

3 directories, 19 files

Actual:

lstr % touch grass
lstr % lstr -G
.
  └── Cargo.toml
  └── flake.lock
  └── rustfmt.toml
  └── LICENSE
  └── CHANGELOG.md
  └── tests
      └── cli.rs
  └── Cargo.lock
  └── README.md
  └── flake.nix
? └── grass
  └── assets
      └── demo.tape
      └── lstr-demo.gif
  └── src
      └── icons.rs
      └── git.rs
      └── main.rs
      └── app.rs
      └── tui.rs
      └── utils.rs
      └── view.rs

3 directories, 19 files

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions