Live data from Hacker News

Eza: A modern, maintained replacement for ls

github.com

181–190 of 250 posts

Re: Eza: A modern, maintained replacement for ls

#181

Earlier quoted context omitted.

I do the same in bash, but it's a bit wordier: _chpwd_hook() { if [[ "$PWD" != "$PREVPWD" ]]; then ls PREVPWD="$PWD" fi } PROMPT_COMMAND=(_chpwd_hook) Goes well with shopt -s autocd alias r='cd -'

Not strictly equivalent, but shorter (and should work with multiple shells): $ cd() { builtin cd $* && ls; } $ cd / bin boot cdrom dev etc home lib lib64 [...]

$* will break on directory names containing spaces and other bash "word" delimiters, use "$@":

    cd() { builtin cd "$@" && ls; }

Re: Eza: A modern, maintained replacement for ls

#182

My ls usage went down 100% after I switched to fish shell. The built in Alt + l command lists the directory contents. Very helpful! And also results in a cleaner shell history.

I realized most of my ls runs come right after `cd`, so I added these to my startup files. Now almost every `cd` does `ls` automatically:

    # bash, simple
    function cd() {
        builtin cd "$@" && ls -l
    }

    # fish, a bit more sophisticated
    function cd

        builtin cd $argv;
        if test $status -gt 0  # there was an error, stop
            return
        end

        # auto print dir info
        if test "$argv" != ""  # not home though
            dir  # aka ls -l ...
        end
    end

Re: Eza: A modern, maintained replacement for ls

#183

One pet peeve of mine is "human readable dates", especially for a directory listing. If I'm scanning for something I copied into a folder yesterday amongst other things, I don't want everything to show "1 day ago" if I'm looking for something I did around 11am. I want the dates and times. That goes for forums like HN. Show me the date/time and also "7 hours ago" or whatever if you have to. I've never understood takin…

I agree. GitHub does this too on commits. "foo.cpp modified last year." It makes no sense, at least without the ability to view additional datetime information.

Yes. If we are in the middle of the current year, modified last year could mean anything from half a year ago to one and a half years ago.

Re: Eza: A modern, maintained replacement for ls

#184

One pet peeve of mine is "human readable dates", especially for a directory listing. If I'm scanning for something I copied into a folder yesterday amongst other things, I don't want everything to show "1 day ago" if I'm looking for something I did around 11am. I want the dates and times. That goes for forums like HN. Show me the date/time and also "7 hours ago" or whatever if you have to. I've never understood takin…

Yes, I hate that approach too. I think it started with either Web 2.0 startups (I was working with one at the time, that implemented that in their product), or with Google and suchlike companies around that time, in their general web apps or social media web apps.

I agree, they should provide the detailed time, then provide the days ago thing too, if they want to.

Re: Eza: A modern, maintained replacement for ls

#185

Earlier quoted context omitted.

I agree. GitHub does this too on commits. "foo.cpp modified last year." It makes no sense, at least without the ability to view additional datetime information.

You can hover over the date for an exact timestamp. Maybe someone can write a userscript to replace the relative dates to exact ones.

the point is that you should not need to hover over the dates to get the exact ones.

it hinders fast viewing of the data, when it is more than a small amount.

Re: Eza: A modern, maintained replacement for ls

#187
post #161

Earlier quoted context omitted.

You're completely missing the point. ~/.programname is an unorganized mess, where someone stuff their dirty laundry, their trash, their food and their passport into the same closet. It doesn't matter if the closet is open or not, nobody but the mentally ill hoarder who created the mess can navigate it. ~/.(local|share|cache) means people put their food in the fridge, their trash into the bin and their sensitive docum…

But that's disorganized! I have a real filing cabinet. In it, I have folders. I don't keep my backup car dongle in one folder, my car invoice in another, my warranty and info from dealer all in different folders. They're all in a folder with the car name on it. The same for my fridge. The invoice, the manual, the warranty info, all in one folder. It is much more disorganized to have a folder for manuals and put them…

> You cite some programs that didn't properly keep their data in a single dotdir, and use that as a reason why a single dotdir was bad?!

No. It's literally the other way around. It's bad that they keep everything in a single dotdir, because now I have to poke through dozens of folders to see where they hide their caches and other bloated garbage that shouldn't be backed up or kept in git, and where between all that garbage they're hiding their config files.

If all caches go to ~/.cache, I can exclude them all with a single setting, and I can put all my configurations in git/backups by adding ~/.config.

Same as with /var/tmp vs /etc vs /var/lib; if I want everything thrown together into a single folder I can just go use Windows.

Re: Eza: A modern, maintained replacement for ls

#188
post #56

Earlier quoted context omitted.

It absolutely did for me. Sadly, it also serves as constant reminder that ~ is a bloody mess because people still can't get used to .local/.share/.config.

Taking this opportunity to remind folks: if you're going to emit a config file from your program, check for $XDG_CONFIG_HOME and use what you find by preference. ~/.config is a decent fallback. Sticking it in ~? It's not the 1980s anymore, please, don't.

Config files are the lesser problem, although it's really, really, really useful for programs to realize that $XDG_CONFIG_HOME exists.

More importantly, please put your caches under $XDG_CACHE_HOME so they don't trash up my backups or git.

And if you're feeling really fancy, put all your runtime stuff in a separate dir in $XDG_RUNTIME_DIR so /tmp doesn't look like someone detonated a zip bomb in there. I want to use it for my temporary files and still find them, thank you very much.

Re: Eza: A modern, maintained replacement for ls

#189
post #126

What’s with all these new versions of GNU utilities being built with the MIT license? Seems like there are a lot of them.

The GNU project didn't invent ls. The GNU coreutils (including ls) were originally new versions of either proprietary (AT&T) or BSD licensed utilities.

Re: Eza: A modern, maintained replacement for ls

#190

For a long time now, I have wanted all command line utilities to consider options --exclude and --include options, where the regex refers to paths. This is applied before they do any displaying or evaluation. So much more convenient than xargs.

You can get something similar with shell globs, and ~not in zsh. e.g. *~*.c(.) to exclude all .c files (and only list files, not directories or anything else).

Looks a bit obscure at a glance due to lack of spaces, but it's not that different from -exclude or "| grep -v".

Post reply on HN