eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
11.41k stars 205 forks source link

feat: option to ignore directories with CACHEDIR.TAG #948

Open SIGSTACKFAULT opened 5 months ago

SIGSTACKFAULT commented 5 months ago

Problem

I like using eza --tree, but I'm extremely mildly inconvenienced by things like cargo target directories:

tether@Gasoline-Veins ~/D/testasdf> eza --tree
.
├── Cargo.lock
├── Cargo.toml
├── shell.nix
├── src
│  └── main.rs
└── target
   ├── CACHEDIR.TAG
   └── debug
      ├── build
      │  ├── httparse-84bd2fb1031ca66f
      │  │  ├── invoked.timestamp
      │  │  ├── out
      │  │  ├── output
      │  │  ├── root-output
      │  │  └── stderr
      │  ├── httparse-99a751e119a4cca3
      │  │  ├── build-script-build
      │  │  ├── build_script_build-99a751e119a4cca3
      │  │  └── build_script_build-99a751e119a4cca3.d
[624 remaining lines clipped]

I already use --git-ignore in my alias, but sometimes there isn't a .gitignore file. So i would like a way to ignore directories which contain CACHEDIR.TAG.

Solution

add an argument, perhaps named --cachedir-ignore, which causes eza to ignore directories which meet the Cache Directory Tagging Specification. I'll poke around in eza today and might do it.

Stretch Goal

add an argument, or extend --ignore-glob to support hiding directories which contain a specific file (e.g., a tool which doesn't add CACHEDIR.TAG, but has some other uniquely-named file in it's cache directory)

SIGSTACKFAULT commented 5 months ago

too WIP for a WIP pr: https://github.com/SIGSTACKFAULT/eza/tree/cachedir-ignore