lsd-rs / lsd

The next gen ls command
Apache License 2.0
13.05k stars 425 forks source link

Custom config.yaml appears to be ignored if the newest sample from README.md used. #921

Closed pi-314 closed 10 months ago

pi-314 commented 11 months ago

Installed with Homebrew, lsd comes (at the time of writing) in v 1.0.0, which doesn't contain two unreleased features (--truncate-owner-*and --literal). At the same time the config sample config.yaml in README.md already provides the configuration elements for that flags. If user creates the custom configuration from this template, it looks like the config.yaml is being ignored. Tre real cause is shown in backtrace:

lsd: Configuration file ~/.config/lsd/config.yaml format error, unknown field `literal`, expected one of `classic`, `blocks`, `color`, `date`, `dereference`, `display`, `icons`, `ignore-globs`, `indicators`, `layout`, `recursion`, `size`, `permission`, `sorting`, `no-symlink`, `total-size`, `symlink-arrow`, `hyperlink`, `header` at line 140 column 1.

thread 'main' panicked at 'Provided file path is invalid', src/main.rs:117:33
stack backtrace:
   0:        0x1008d756c - __mh_execute_header
   1:        0x100834a20 - __mh_execute_header
   2:        0x1008bcef8 - __mh_execute_header
   3:        0x1008d7324 - __mh_execute_header
   4:        0x1008bd638 - __mh_execute_header
   5:        0x1008bdd54 - __mh_execute_header
   6:        0x1008d78ac - __mh_execute_header
   7:        0x1008d7820 - __mh_execute_header
   8:        0x1008bd8cc - __mh_execute_header
   9:        0x100946aa8 - __mh_execute_header
  10:        0x10094694c - __mh_execute_header
  11:        0x1007d388c - __mh_execute_header
  12:        0x100791f50 - __mh_execute_header
  13:        0x1007e8600 - __mh_execute_header

But this can be discovered only by specifying the --config-file flag explicitly. For the normal run it looks like the config file just had no effect at all.

Expected behavior

lsd should either crash if some unknown element exists in yaml config file or maybe display a warning. (However the second option would break compatibility with ls.)

Actual behavior

lsd just ignores provided config.yaml silently.

zwpaper commented 10 months ago

the master branch is for latest dev features, please check https://github.com/lsd-rs/lsd/tree/v1.0.0

close due to duplicated with https://github.com/lsd-rs/lsd/issues/922

/close

muniu-bot[bot] commented 10 months ago

@zwpaper: Closing this issue.

In response to [this](https://github.com/lsd-rs/lsd/issues/921#issuecomment-1745199142): >the master branch is for latest dev features, please check https://github.com/lsd-rs/lsd/tree/v1.0.0 > >close due to duplicated with https://github.com/lsd-rs/lsd/issues/922 > >/close > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.