lsd-rs / lsd

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

Option `--icon` with absent mode argument should be equivalent to `--icon always` #956

Open turbocrime opened 9 months ago

turbocrime commented 9 months ago

existing behavior

the --icon option requires an argument

~ $ lsd --icon
error: a value is required for '--icon <MODE>' but none was supplied
  [possible values: always, auto, never]
~ $ 

expected behavior

the --icon option with no argument should enable icons

~ $ lsd --icon
📂 Desktop  📂 Developer  📂 Documents  📂 Downloads  📂 Library  📂 Movies  📂 Music  📂 Pictures  📂 Public
~ $

details

it is reasonable to assume that manual application of an --icon option with no arguments intends --icon always

in my ~/.config/lsd/config.yml i have

icons:
  when: never
  theme: unicode

i have many short aliases defined in my .zshrc for various modes and behaviors, none of them involving icons.

occasionally, i might want to display icons. it would be nice to simply run lsd --icon (or any of my aliases, with an icon option) to activate icon display.

i understand this feature might have been deliberately avoided due to the possibility for accidental application of following file name arguments or expanded glob values following a bare --icon option. this type of mistake is already a well-understood possibility, and the broadly accepted solution is a standard -- options-terminating sentinel.