Giter Site home page Giter Site logo

lsd's Introduction

IMPORTANT: This is the development documents, please check the docs in Tags if you installed from the released ones.

The current newest release is: v1.1.2


LSD (LSDeluxe)

license Latest version build codecov versions

image

This project is a rewrite of GNU ls with lots of added features like colors, icons, tree-view, more formatting options etc. The project is heavily inspired by the super colorls project.

Installation

Packaging status Packaging status

Prerequisites

Install the patched fonts of powerline nerd-font and/or font-awesome. Have a look at the Nerd Font README for more installation instructions. Don't forget to setup your terminal in order to use the correct font.

OS/Distro Command
Archlinux pacman -S lsd
Fedora dnf install lsd
Gentoo sudo emerge sys-apps/lsd
macOS brew install lsd or sudo port install lsd
NixOS nix-env -iA nixos.lsd
FreeBSD pkg install lsd
NetBSD or any pkgsrc platform pkgin install lsd or cd /usr/pkgsrc/sysutils/lsd && make install
OpenBSD pkg_add lsd
Windows scoop install lsd or winget install --id lsd-rs.lsd
Android (via Termux) pkg install lsd
Debian sid and bookworm apt install lsd
Ubuntu 23.04 (Lunar Lobster) apt install lsd
Earlier Ubuntu/Debian versions snap discontinued, use From Binaries
Solus eopkg it lsd
Void Linux sudo xbps-install lsd
openSUSE sudo zypper install lsd

From source

With Rust's package manager cargo, you can install lsd via:

cargo install lsd

If you want to install the latest master branch commit:

cargo install --git https://github.com/lsd-rs/lsd.git --branch master

From Binaries

The release page includes precompiled binaries for Linux, macOS and Windows for every release. You can also get the latest binary of master branch from the GitHub action build artifacts (choose the top action and scroll down to the artifacts section).

Configuration

lsd can be configured with a configuration file to set the default options. Check Config file content for details.

Config file location

Non-Windows

On non-Windows systems lsd follows the XDG Base Directory Specification convention for the location of the configuration file. A config.yaml or config.yml file will be searched for in these locations, in order:

  • $HOME/.config/lsd
  • $XDG_CONFIG_HOME/lsd

On most systems these are mapped to the same location, which is ~/.config/lsd/config.yaml.

Windows

On Windows systems lsd searches for config.yaml or config.yml in the following locations, in order:

  • %USERPROFILE%\.config\lsd
  • %APPDATA%\lsd

These are usually something like C:\Users\username\AppData\Roaming\lsd\config.yaml and C:\Users\username\.config\lsd\config.yaml respectively.

Custom

You can also provide a configuration file from a non-standard location: lsd --config-file [PATH]

Config file content

This is an example config file with the default values and some additional remarks.
# == Classic ==
# This is a shorthand to override some of the options to be backwards compatible
# with `ls`. It affects the "color"->"when", "sorting"->"dir-grouping", "date"
# and "icons"->"when" options.
# Possible values: false, true
classic: false

# == Blocks ==
# This specifies the columns and their order when using the long and the tree
# layout.
# Possible values: permission, user, group, context, size, date, name, inode, links, git
blocks:
  - permission
  - user
  - group
  - size
  - date
  - name

# == Color ==
# This has various color options. (Will be expanded in the future.)
color:
  # When to colorize the output.
  # When "classic" is set, this is set to "never".
  # Possible values: never, auto, always
  when: auto
  # How to colorize the output.
  # When "classic" is set, this is set to "no-color".
  # Possible values: default, custom
  # When "custom" is set, lsd will look in the config directory for `colors.yaml`.
  theme: default

# == Date ==
# This specifies the date format for the date column. The freeform format
# accepts a strftime like string.
# When "classic" is set, this is set to "date".
# Possible values: date, locale, relative, '+<date_format>'
# `date_format` will be a `strftime` formatted value. e.g. `date: '+%d %b %y %X'` will give you a date like this: 17 Jun 21 20:14:55
date: date

# == Dereference ==
# Whether to dereference symbolic links.
# Possible values: false, true
dereference: false

# == Display ==
# What items to display. Do not specify this for the default behavior.
# Possible values: all, almost-all, directory-only
# display: all

# == Icons ==
icons:
  # When to use icons.
  # When "classic" is set, this is set to "never".
  # Possible values: always, auto, never
  when: auto
  # Which icon theme to use.
  # Possible values: fancy, unicode
  theme: fancy
  # Separator between icon and the name
  # Default to 1 space
  separator: " "

# == Ignore Globs ==
# A list of globs to ignore when listing.
# ignore-globs:
#   - .git

# == Indicators ==
# Whether to add indicator characters to certain listed files.
# Possible values: false, true
indicators: false

# == Layout ==
# Which layout to use. "oneline" might be a bit confusing here and should be
# called "one-per-line". It might be changed in the future.
# Possible values: grid, tree, oneline
layout: grid

# == Recursion ==
recursion:
  # Whether to enable recursion.
  # Possible values: false, true
  enabled: false
  # How deep the recursion should go. This has to be a positive integer. Leave
  # it unspecified for (virtually) infinite.
  # depth: 3

# == Size ==
# Specifies the format of the size column.
# Possible values: default, short, bytes
size: default

# == Permission ==
# Specify the format of the permission column
# Possible value: rwx, octal, attributes (windows only), disable
# permission: rwx

# == Sorting ==
sorting:
  # Specify what to sort by.
  # Possible values: extension, name, time, size, version
  column: name
  # Whether to reverse the sorting.
  # Possible values: false, true
  reverse: false
  # Whether to group directories together and where.
  # When "classic" is set, this is set to "none".
  # Possible values: first, last, none
  dir-grouping: none

# == No Symlink ==
# Whether to omit showing symlink targets
# Possible values: false, true
no-symlink: false

# == Total size ==
# Whether to display the total size of directories.
# Possible values: false, true
total-size: false

# == Hyperlink ==
# Attach hyperlink to filenames
# Possible values: always, auto, never
hyperlink: never

# == Symlink arrow ==
# Specifies how the symlink arrow display, chars in both ascii and utf8
symlink-arrow: 

# == Header ==
# Whether to display block headers.
# Possible values: false, true
header: false

# == Literal ==
# Whether to show quotes on filenames.
# Possible values: false, true
literal: false

# == Truncate owner ==
# How to truncate the username and group names for a file if they exceed a certain
# number of characters.
truncate-owner:
  # Number of characters to keep. By default, no truncation is done (empty value).
  after:
  # String to be appended to a name if truncated.
  marker: ""

Theme

lsd can be configured with theme files to set the colors or icons.

Color Theme

Color theme can be configured in the configuration file(color.theme), The valid theme configurations are:

  • default: the default color scheme shipped in lsd
  • custom: use a custom color scheme defined in colors.yaml
  • (deprecated) theme_file_name(yaml): use the theme file to specify colors (without the yaml extension)

When set to custom, lsd will look for colors.yaml in the XDG Base Directory, e.g. ~/.config/lsd/colors.yaml

When configured with the theme-file-name which is a yaml file, lsd will look up the theme file in the following way:

  • relative name: check the XDG Base Directory, e.g. ~/.config/lsd/themes/.yaml
  • absolute name: use the file path and name to find theme file

Check Color Theme file content for details.

Color Theme file content

Theme file use the crossterm to configure the colors, check crossterm for supported colors.

Color table: https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg

Please notice that color values would ignore the case, both lowercase and UPPERCASE is supported.

This is the default theme scheme shipped with lsd.

user: 230
group: 187
permission:
  read: dark_green
  write: dark_yellow
  exec: dark_red
  exec-sticky: 5
  no-access: 245
  octal: 6
  acl: dark_cyan
  context: cyan
date:
  hour-old: 40
  day-old: 42
  older: 36
size:
  none: 245
  small: 229
  medium: 216
  large: 172
inode:
  valid: 13
  invalid: 245
links:
  valid: 13
  invalid: 245
tree-edge: 245
git-status:
  default: 245
  unmodified: 245
  ignored: 245
  new-in-index: dark_green
  new-in-workdir: dark_green
  typechange: dark_yellow
  deleted: dark_red
  renamed: dark_green
  modified: dark_yellow
  conflicted: dark_red

When creating a theme for lsd, you can specify any part of the default theme, and then change its colors, the items missed would fall back to use the default colors.

Please also notice that an empty theme is NOT supported due to a bug in serde lib.

Icon Theme

Icon theme can be configured in a fixed location, $XDG_CONFIG_DIR/lsd/icons.yaml, for example, ~/.config/lsd/icons.yaml on macOS, please check Config file location to make sure where is $XDG_CONFIG_DIR.

As the file name indicated, the icon theme file is a yaml file.

Check Icon Theme file content for details.

Icon Theme file content

lsd support 3 kinds of icon overrides, by name, by filetype and by extension. The final set of icons used will be a combination of what is shipped with in lsd with overrides from config applied on top of it. You can find the default set of icons here.

Both nerd font glyphs and Unicode emojis can be used for icons. You can find an example of icons customization below.

name:
  .trash: 
  .cargo: 
  .emacs.d: 
  a.out: 
extension:
  go: 
  hs: 
  rs: 🦀
filetype:
  dir: 📂
  file: 📄
  pipe: 📩
  socket: 󰆨
  executable: 
  symlink-dir: 
  symlink-file: 
  device-char: 
  device-block: 󰜫
  special: 

External Configurations

Required

Enable nerd fonts for your terminal, URxvt for example in .Xresources:

URxvt*font:    xft:Hack Nerd Font:style=Regular:size=11

Optional

In order to use lsd when entering the ls command, you need to add this to your shell configuration file (~/.bashrc, ~/.zshrc, etc.):

alias ls='lsd'

Some further examples of useful aliases:

alias l='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'

F.A.Q

Uses unknown compression for member 'control.tar.zst' when using deb

Zst compression is supported starting from Debian 12 and Ubuntu 21.10, Please use the _xz.deb released starting from lsd v1.1.0.

Please check #891 for details or manual fixes.

Custom Color Schemes for Windows

For lsd currently, it reads a system environment variable called LS_COLORS. Please look at the marked solution in this post, which contains a guide on how to set a color scheme.

Icons not showing up

For lsd to be able to display icons, the font has to include special font glyphs. This might not be the case for most fonts that you download. Thankfully, you can patch most fonts using NerdFont and add these icons. Or you can just download an already patched version of your favorite font from NerdFont font download page. Here is a guide on how to set up fonts on macOS and Android.

To check if the font you are using is set up correctly, try running the following snippet in a shell and see if that prints a folder icon. If it prints a box, or question mark or something else, then you might have some issues in how you set up the font or how your terminal emulator renders the font.

echo $'\uf115'

Icons missing or not rendering correctly using PuTTY/KiTTY on Windows

First of all, make sure a patched font is installed and PuTTY/KiTTY is configured to use it, please check Prerequisites.

There are problems for PuTTY/KiTTY to show 2 char wide icons, make sure using a 1 char wide font like Hack Regular Nerd Font Complete Mono Windows Compatible, check this issue for detail.

Colors

You can customize filetype colors using LS_COLORS and other colors using the theme.

The default colors are:

User/Group Permission File Type (changes based on your terminal colorscheme) Date File Size
#ffffd7 User #00d700 Read #0087ff Directory #00d700 within the last hour #ffffaf Small File
#d7d7af Group #d7ff87 Write #00d700 Executable File #00d787 within the last day #ffaf87 Medium File
#af0000 Execute #ffffff Non-Executable File #00af87 older #d78700 Large File
#ff00ff Execute with Stickybit #af0000 Broken Symlink #ffffff Non File
#d75f87 No Access #00d7d7 Pipe/Symlink/Blockdevice/Socket/Special
#d78700 CharDevice

Checkout trapd00r/LS_COLORS and sharkdp/vivid for help in theming using LS_COLORS.

First char of folder/file getting trimmed

Workaround for Konsole: ㅤEdit the config file (or create it if it doesn't already exist) and paste the following into it (contains invisible Unicode characters):

icons:
    separator: ""

This is a known issue in a few terminal emulators. Try using a different terminal emulator like. Alacritty and Kitty are really good alternatives. You might also want to check if your font is responsible for causing this. To verify this, try running lsd with icons disabled and if it still does not have the first character, then this is an lsd bug:

lsd --icon never --ignore-config

UTF-8 Chars

lsd will try to display the UTF-8 chars in file name, A U+FFFD REPLACEMENT CHARACTER(�) is used to represent the invalid UTF-8 chars.

Icons are showing up strangely

Nerd Fonts is moving the code points of the Material Design Icons in 3.0, so lsd has updated the icons in #830. If your icons look weird, use fonts that have been patched using Nerd Fonts v2.3.0 or later.

See also: https://github.com/ryanoasis/nerd-fonts/releases/tag/v2.3.3

Contributors

Everyone can contribute to this project, improving the code or adding functions. If anyone wants something to be added we will try to do it.

As this is being updated regularly, don't forget to rebase your fork before creating a pull-request.

Credits

Special thanks to:

lsd's People

Contributors

0jdxt avatar 999eagle avatar alexanderkjall avatar alichtman avatar allenap avatar aninternettroll avatar babkock avatar boxdot avatar cat12079801 avatar danieldulaney avatar dvvvvvv avatar hemreari avatar icxolu avatar juansc avatar lippyboy avatar meain avatar merelymyself avatar michaelaug avatar mmatous avatar nix6839 avatar orangefran avatar palfrey avatar peltoche avatar poita66 avatar rivy avatar starz0r avatar teamtamoad avatar thealakazam avatar tranzystorekk avatar zwpaper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lsd's Issues

Provide a Flag to Hide Icons

Icons can be a problem when interactive with pipes, to be more compatible with ls. For example:

$ lsd | grep 'foo.txt' | xargs rm  # not work
$ ls | grep 'foo.txt' | xargs rm  # works

PS. Is it a bug for lsd to print an extra line?
i.e. lsd | wc -l (always) == ls | wc -l + 1

Add exa to benchmarks

As exa is a popular ls replacement in Rust, speed comparison with it would be more interesting than with ruby-based colorls. Right now I have following results on my potato:

$ hyperfine --warmup 10 -i 'exa -Rla ~' 'target/release/lsd -Rla ~' 'ls -Rla ~'
Benchmark #1: exa -Rla ~
  Time (mean ± σ):      7.500 s ±  0.087 s    [User: 8.835 s, System: 7.809 s]
  Range (min … max):    7.396 s …  7.634 s
 
Benchmark #2: target/release/lsd -Rla ~
  Time (mean ± σ):      9.336 s ±  0.038 s    [User: 4.607 s, System: 4.672 s]
  Range (min … max):    9.283 s …  9.424 s
 
Benchmark #3: ls -Rla ~
  Time (mean ± σ):      1.913 s ±  0.013 s    [User: 821.4 ms, System: 1086.9 ms]
  Range (min … max):    1.893 s …  1.931 s
 
  Warning: Ignoring non-zero exit code.
 
Summary
  'ls -Rla ~' ran
    3.92 ± 0.05 times faster than 'exa -Rla ~'
    4.88 ± 0.04 times faster than 'target/release/lsd -Rla ~'

Add the -F flag

following #42 discussion.

This flag should have the same behavior that the classic ls -F:

  -F, --classify             append indicator (one of */=>@|) to entries
@ means symbolic link (or that the file has extended attributes).
* means executable.
= means socket.
| means named pipe.
> means door.
/ means directory.

Use terminal color scheme

Expected behavior

lsd uses colors from my terminal color scheme, being consistent with all the other command line tools.

Actual behavior

It appears lsd uses hard-coded colors, instead of the terminal color scheme. The hard coded colors don't look as nice. See screenshot below.

image

My terminal colors:
image

TeX icon not visible enough

By @alaymari from #42

Regarding the icons, I noticed that the TeX file has an icon which is so thin, it is nearly invisible. Can a different icon be set for that; maybe the txt file icon itself would be better than the existing one.

Flags should be able to Accept Multiple Times

.. with the last value counted.

I aliased lsd with lsd=lsd --icon=never, then I want icons to print, but:

$ lsd --icon=auto
error: The argument '--icon <icon>' was provided more than once, but cannot be used multiple times

which is not expected. Consider to adopt this same behaviour as ls?

Make the order by name case insensitive

Current outpout:

 tmp  test  %  ⎈ prodild  prod  lsd -l
.rw-r--r--  peltoche  users  0 B  Mon Dec 10 10:16:50 2018    AAAAA
.rw-r--r--  peltoche  users  0 B  Mon Dec 10 10:16:57 2018    BBBB
.rw-r--r--  peltoche  users  0 B  Mon Dec 10 10:16:53 2018    aaaaa
.rw-r--r--  peltoche  users  0 B  Mon Dec 10 10:16:59 2018    bbbbb

expected output:

 tmp  test  %  ⎈ prodild  prod  \ls -l
total 0
-rw-r--r-- 1 peltoche users 0 Dec 10 10:16 aaaaa
-rw-r--r-- 1 peltoche users 0 Dec 10 10:16 AAAAA
-rw-r--r-- 1 peltoche users 0 Dec 10 10:16 BBBB
-rw-r--r-- 1 peltoche users 0 Dec 10 10:16 bbbbb

LSD fails with the error 'failed to get the group name'

When attached to my company's LAN, LSD works as per the "Expected behaviour". However, when attached to my home network, LSD fails as per the "Actual behaviour".

I can see that this is is related to: #48 which is now closed.

I'm suspecting this is down to the fact that when I'm not on the office LAN, my "group" shows up as a number, rather than an actual name, so no name exists.

Is it possible to request that this fails gracefully?

Expected behaviour

Office LAN

➜  ~ ls -l
drwx--x---  myusername  MYCOMPANY\Users       -   Thu Sep 27 12:24:30 2018    Applications

Home LAN

➜  ~ ls -l
drwx--x---  myusername  123456       -   Thu Sep 27 12:24:30 2018    Applications

Actual behaviour

Office LAN behaves as expected.

Home LAN

➜  ~ RUST_BACKTRACE=1 ls -l
thread 'main' panicked at 'failed to get the group name', libcore/option.rs:1008:5
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>

Color the file names in green if the file is executable

How to test:

mkdir /tmp/test

touch /tmp/test/executable
touch /tmp/test/non_executable
chmod 644 /tmp/test/non_executable
chmod 777 /tmp/test/executable

lsd /tmp/test # `executable` should be green and `non_executable` should yellow (the default color)

Add a --classic flag

This flag should override all the other flag and make the output similar to the classic ls command

It would be useful for the people like me which set the --color=always into the flags but sometime need the "classic" output in order to work with pipes.

Example

ls --color=always --classic | xargs rm # should work

Display order

First of all, thanks for a very handy tool.

I noticed that the sorted list is displayed sidewise by lsd, whereas ls displays it from top to bottom. It just makes it difficult to find a file as we would be looking at the list in a different direction. Can the display be made similar to that of ls?

Are there any plans to implement all switches of ls?

`lsd` panics with `failed to print the grid` when called without arguments in certain folders

I noticed this in my Downloads folder, which has a lot of files.
The error only occurs when calling lsd without arguments or with -a. Any other combination of arguments seems to work.

Backtrace:

#~> env RUST_BACKTRACE=1 lsd
thread 'main' panicked at 'failed to print the grid', libcore/option.rs:1000:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:477
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:391
   6: rust_begin_unwind
             at libstd/panicking.rs:326
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   8: core::option::expect_failed
             at libcore/option.rs:1000
   9: lsd::display::Display::print_outputs
  10: lsd::core::Core::run_inner
  11: lsd::main
  12: std::rt::lang_start::{{closure}}
  13: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  14: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:103
  15: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392s
             at libstd/rt.rs:58
  16: main
  17: __libc_start_main
  18: _start

Can't handle invalid encoding

I don't know how much it should be up to lsd to handle this, but when there is a file with invalid encoding in a folder, lsd crashes with

thread 'main' panicked at 'failed to encode file name', libcore/option.rs:1000:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:477
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:391
   6: rust_begin_unwind
             at libstd/panicking.rs:326
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   8: core::option::expect_failed
             at libcore/option.rs:1000
   9: lsd::meta::Meta::from_path
  10: lsd::core::Core::list_folder_content
  11: lsd::core::Core::run_inner
  12: lsd::core::Core::run_inner
  13: lsd::core::Core::run_inner
  14: lsd::core::Core::run_inner
  15: lsd::main
  16: std::rt::lang_start::{{closure}}
  17: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  18: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:103
  19: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  20: main
  21: __libc_start_main
  22: _start

Broken symbolic links

Consider a directory with broken symlink:

$ mkdir temp && cd temp
$ ln -s `pwd`/a `pwd`/b

Expected behavior

Classic ls shows symlink, and, if you enable color, it will show that it is broken.

$ /bin/ls -la
total 8
drwxr-xr-x 2 kuviman kuviman 4096 Dec 13 22:52 .
drwxr-xr-x 9 kuviman kuviman 4096 Dec 13 22:51 ..
lrwxrwxrwx 1 kuviman kuviman   25 Dec 13 22:52 b -> /home/kuviman/temp/a

Actual behavior

But lsd just throws an error

$ lsd -la
cannot access './b': No such file or directory (os error 2)

It doesn't crash as before(#2), but still would be better if broken symlinks were highlighted red like in ls

Do not print the size in case of folders or symlinks

The current output is:

drwxr-xr-x  peltoche  users    4 KB  Thu Dec  6 00:34:14 2018    src/
.rw-r--r--  peltoche  users    8 KB  Thu Dec  6 00:29:01 2018    Cargo.lock

The 4KB is the folder size but doesn't give much information as it's not the content size. In order to simplify the output I propose to make the output looks like:

drwxr-xr-x  peltoche  users       -  Thu Dec  6 00:34:14 2018    src/
.rw-r--r--  peltoche  users    8 KB  Thu Dec  6 00:29:01 2018    Cargo.lock

The size is replaced by a dash - like the exa program.

No usable output or panic when not outputting to a terminal

Example 1

#~> lsd -a | wc
thread 'main' panicked at 'failed to retrieve terminal size', /home/yann/.cargo/registry/src/github.com-1ecc6299db9ec823/lsd-0.6.1/src/display.rs:29:21

Expected behavior: properly pipe contents to next program, expecting infinite width (e.g. "0")

Example 2

#~> lsd -al > test

Test now contains a lot of unprintable characters, e.g. it looks like this:

�[38;5;33md�[0m�[38;5;40mr�[38;5;192mw�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[0m  �[38;5;230myann�[0m  �[38;5;187musers�[0m  �[38;5;229m    4 KB�[0m  �[38;5;40mWed Dec  5 04:44:57 2018�[0m  �[38;5;33m  .git/�[0m
�[38;5;33md�[0m�[38;5;40mr�[38;5;192mw�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[0m  �[38;5;230myann�[0m  �[38;5;187musers�[0m  �[38;5;229m    4 KB�[0m  �[38;5;40mWed Dec  5 04:23:13 2018�[0m  �[38;5;33m  src/�[0m
�[38;5;33md�[0m�[38;5;40mr�[38;5;192mw�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[0m  �[38;5;230myann�[0m  �[38;5;187musers�[0m  �[38;5;229m    4 KB�[0m  �[38;5;40mWed Dec  5 04:24:43 2018�[0m  �[38;5;33m  target/�[0m
�[38;5;184m.�[0m�[38;5;40mr�[38;5;192mw�[38;5;168m-�[38;5;40mr�[38;5;168m--�[38;5;40mr�[38;5;168m--�[0m  �[38;5;230myann�[0m  �[38;5;187musers�[0m  �[38;5;229m   26 B �[0m  �[38;5;40mWed Dec  5 04:23:13 2018�[0m  �[38;5;184m  .gitignore�[0m
�[38;5;184m.�[0m�[38;5;40mr�[38;5;192mw�[38;5;168m-�[38;5;40mr�[38;5;168m--�[38;5;40mr�[38;5;168m--�[0m  �[38;5;230myann�[0m  �[38;5;187musers�[0m  �[38;5;229m  119 B �[0m  �[38;5;40mWed Dec  5 04:23:13 2018�[0m  �[38;5;184m  .travis.yml�[0m
...

Expected behavior: don't print escape/color codes when not outputting to a terminal

Proposed solution

  1. fetch terminal_size() at program startup and cache the result.
  2. If term_size is None, disable color formatting for all outputs
  3. If term_size is None, either set a reasonable default width for text files in print_grid or just default to print_one_per_line instead

sort by mod time

Just curious if a sort by mod time (ie, ls -t) is in the plan.....

Don't list directories first

It would be great if there were an option to not put the directories first. The current default behavior is different than the behavior of ls, which makes it kind of confusing. We have these fancy icons and colors so it's already easy to tell which items are directories!

Current behavior:

drwxr-xr-x  user  group      -   Tue Dec  4 20:27:57 2018    Afolder
drwxr-xr-x  user  group      -   Tue Dec  4 20:27:51 2018    Bfolder
drwxr-xr-x  user  group      -   Fri Jan 11 19:47:11 2019    Zfolder
.rw-r--r--  user  group    6 KB  Fri Jan 11 18:56:06 2019    Afile
.rw-r--r--  user  group   97 B   Sat Nov  4 18:14:08 2017    Bfile
.rw-r--r--  user  group   88 B   Sat Nov  4 18:14:13 2017    Zfile

desired behavior:

.rw-r--r--  user  group    6 KB  Fri Jan 11 18:56:06 2019    Afile
drwxr-xr-x  user  group      -   Tue Dec  4 20:27:57 2018    Afolder
.rw-r--r--  user  group   97 B   Sat Nov  4 18:14:08 2017    Bfile
drwxr-xr-x  user  group      -   Tue Dec  4 20:27:51 2018    Bfolder
.rw-r--r--  user  group   88 B   Sat Nov  4 18:14:13 2017    Zfile
drwxr-xr-x  user  group      -   Fri Jan 11 19:47:11 2019    Zfolder

snap version gets "Permission denied"

This is on ubuntu 18.04.1

Expected behavior

lsd to give a listing

Actual behavior

$ lsd
cannot open directory'.': Permission denied (os error 13)

Add some icons for the specific filetypes

(following the #42 discussion)

The idea is to be able to recognize all the specific filetypes (char devices / pipes / symlinks / etc) by setting some specific icons. The icons are not defined yet.

Why do you need a special font?

I don't know why you need a special font?

Is it just because the default unicode icons for folders (📁) are too big?

I'm asking because the unicode characters are supported by default in my terminal, but not the special fonts.

I think the symbols you need can definitely be found in default unicode: 🗋 🗁🗎 🔗

Of course you could still keep support for the people that wanted prettier fonts, but I think it would be nice if lsd worked out of the box with standard unicode.

If you think this is a good idea, I will try to make a patch that uses the unicode symbols if the custom font can't be found.

Highlight files that are executable or have suid

The default gnu ls adds a * at the end of executable files to mark them.
It also colors them differently, and it highlights in red files that have a setuid bit on.

It would be really useful if lsd did that too to mark them easily.
They could also have an icon (assuming the file doesn't have one already) - I'm thinking the dollar icon for an executable, and a # for a suid, but I don't have strong opinions on this.

Make lsd compile with ARM as target

Expected behavior

On small SBC systems, lsd would be extra useful since a lot of interaction happens via ssh and the console on these systems. An ARM target would be helpful to ease the install.

Actual behavior

No ARM target is available, lsd needs to be build from source, probable issues present

add the --color option

This options would be presented as followed:

lsd --color=never # never print the colors 
lsd --color=auto # print colors only when the output is a tty
lsd --color=always # always print the colors

Change the display order

In the current stats the ls print the files starting from left to right but the default ls print its content in the top down direction

Feature request: Choose blocks to display in long format

Add a feature which would let users choose the blocks to be displayed. The blocks could be a comma separated list.

Maybe something like:

lsd --blocks permission,size,name

This would just show these blocks. Maybe even show them in that specific order as well.

Print name of tree root

Current behavior is a little bit confusing when printing tree of several dirs:

$ target/release/lsd --tree ~/dir*
├── subdir11
│  ├── file111
│  └── file112
└── subdir12
│  ├── file121
│  └── file122
├── subdir21
│  ├── file211
│  └── file212
└── subdir22
│  ├── file221
│  └── file222

For comparison:

$ exa -T ~/dir*
/home/user/dir1
├── subdir11
│  ├── file111
│  └── file112
└── subdir12
   ├── file121
   └── file122
/home/user/dir2
├── subdir21
│  ├── file211
│  └── file212
└── subdir22
   ├── file221
   └── file222

And can say that printing at the beginning of line after last dir entry makes it even more confusing.

Set an unicode only icon set

Create the option --icons like:

lsd --icons=none # Do not display icons
lsd --icons=unicode # Display only unicode icons
lsd --icons=default # Display the default (current) icon set

The unicode type is for the user who doesn't want to download a specific font. It should be available with all the classic fonts and terminals.

Non-deterministic panic (broken pipe) using --tree option

Expected behavior

/tmp/tmp.EHAycWKNJu $ RUST_BACKTRACE=1 lsd --tree | head -n 5
├── example-file-1
├── example-file-10
├── example-file-11
├── example-file-12
├── example-file-13

lsd does not panic. :)

Actual behavior

/tmp/tmp.EHAycWKNJu $ RUST_BACKTRACE=1 lsd --tree | head -n 5
├── example-file-1
├── example-file-10
├── example-file-11
├── example-file-12
├── example-file-13
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', src/libstd/io/stdio.rs:700:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:210
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:224
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:487
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:394
   6: std::panicking::begin_panic_fmt
             at src/libstd/panicking.rs:349
   7: std::io::stdio::_print
             at src/libstd/io/stdio.rs:700
             at src/libstd/io/stdio.rs:709
   8: lsd::display::Display::print_tree_row
   9: lsd::core::Core::display_as_tree
  10: lsd::core::Core::run_inner
  11: lsd::main
  12: std::rt::lang_start::{{closure}}
  13: std::panicking::try::do_call
             at src/libstd/rt.rs:59
             at src/libstd/panicking.rs:306
  14: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:102
  15: std::rt::lang_start_internal
             at src/libstd/panicking.rs:285
             at src/libstd/panic.rs:398
             at src/libstd/rt.rs:58
  16: main
  17: __libc_start_main
  18: _start

Interestingly, this bug seems to be non-deterministic. If I repeat the command multiple times, the process terminates sometimes with and sometimes without a panic.

thread 'main' panicked at 'failed to get the group name', libcore/option.rs:1008:5

I got this error msg after installing rustfmt(Don't know if this matters).

env: macOS 10.12.6 with rustup 1.16.0 and cargo 1.31.0

The detail is:

thread 'main' panicked at 'failed to get the group name', libcore/option.rs:1008:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::option::expect_failed
   9: <lsd::meta::owner::Owner as core::convert::From<&'a std::fs::Metadata>>::from
  10: lsd::meta::Meta::from_path
  11: lsd::core::Core::list_folder_content
  12: lsd::core::Core::run_inner
  13: lsd::core::Core::run
  14: lsd::main
  15: std::rt::lang_start::{{closure}}
  16: std::panicking::try::do_call
  17: __rust_maybe_catch_panic
  18: std::rt::lang_start_internal
  19: main

Themes

It seems like the colors that lsd uses are hard coded. It'd be awesome if it supported custom colors.

I'd love to develop a theme that uses colors for file names and shades of gray for everything else - lighter shade for more recent dates and larger file sizes.

Create a Layout enum

(This issue was originally created to respond to a display order issue but it seems it was useless. @loewenheim have proposed a great idea about a Layout enum which is not implemented yet and so the subject have changed from the original purpose.)

This option would allow to change de display direction (left-right or top-down)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.