Comment by anthk

Comment by anthk 19 hours ago

12 replies

Modern doesn't always mean better. A better replacement for mplayer was mpv, and in some cases mplayer was faster than mpv (think about legacy machines).

   - bat it's a useless cat. Cat concatenates files. ANSI colour breaks that.

   - alias ls='ls -Fh' , problem solved. Now you have * for executables, / for directories and so on.

   - ncdu it's fine, perfect for what it does

   - iomenu it's much faster than fzf and it almost works the same

   - jq it's fine, it's a good example on a new Unix tool

   - micro it's far slower than even vim

   - instead of nnn, sff https://github.com/sylphenix/sff with soap(1) (xdg-open replacement) from https://2f30.org create a mega fast environment. Add MuPDF and sxiv, and nnn and friends will look really slow compared to these.
Yes, you need to set config.h under both sff and soap, but they will run much, much faster than any Rust tool on legacy machines.
oneeyedpigeon 18 hours ago

> bat it's a useless cat. Cat concatenates files. ANSI colour breaks that.

It's useless as a cat replacement, I agree. The article really shouldn't call it that, although the program's GitHub page does self-describe it as "a cat clone". It's more of a syntax highlighter combined with a git diff viewer (I do have an issue with that; it should be two separate programs, not one).

  • mcswell 14 hours ago

    I have two uses for 'cat':

    1) Piping the contents of some file into a process.

    2) Showing the contents of some short file.

    Now (1) is better done with redirection (< or >). The only time I use cat is when I'm testing some pipeline where I only want a few lines of input, so I use 'head' or something similar. Once I have the pipeline working right, I edit the command line to replace 'head' with 'cat'. Easier than re-arranging whole words.

    And it's rare that (2) is the right solution--too often I find that the file was longer than I thought, and I have to use 'more' (actually 'less').

    So a replacement for 'cat' that does color coding sounds pretty much useless to me.

    • oneeyedpigeon 14 hours ago

      Right, don't think of it as a cat replacement, think of it as a coloriser. If you never want a coloriser, fair enough, ignore bat! But I find it quite nice when I'm reading through source code or Markdown.

stryan 15 hours ago

> bat it's a useless cat. Cat concatenates files. ANSI colour breaks that.

From the README:

>Whenever bat detects a non-interactive terminal (i.e. when you pipe into another process or into a file), bat will act as a drop-in replacement for cat and fall back to printing the plain file contents

bat works as normal cat for normal uses of cat and a better cat for all those "useless cat" situations we find ourselves in.

lucasoshiro 18 hours ago

> bat it's a useless cat

I can't see bat as a "useless cat" or a replacement for cat except for reading source code in the terminal. It's more a like a less with syntax highlight or a read-only vim.

  • ed_blackburn 18 hours ago

    I agree with this. cat is great for "cating" bat is great for throwing shit on the terminal in a fashion that makes it semantically easier to reason with, two different use cases.

    • anthk 16 hours ago

      There's ccze which colorizes stuff without creating a supposed cat(1) replacement.

  • godshatter 13 hours ago

    Is there a stand-alone syntax highlighting cli tool? It sounds like we need one if one doesn't exist yet. Something that would take an input stream, a language parameter, and maybe an optional color syntax highlighting config or something. It would be something that can be tacked onto any command so the final output has the appropriate syntax highlighting.

  • drob518 18 hours ago

    Part of the problem is “naming/marketing.” Bat compares ITSELF to cat, not to more/less. IMO, this confuses the issue.

    • ziml77 17 hours ago

      I think that's because it's super common to use cat to quickly view a file. It has the nice property of using your terminal's scrollback rather than putting you into a pager application. For that use-case it is an alternative to cat.

      That said, I've never really cared much about missing syntax highlighting for cases where I'm viewing file contents with cat. So the tool doesn't really serve a purpose for me and instead I'll continue to load up vim/neovim if I want to view a file with syntax highlighting.

    • listeria 15 hours ago

      Maybe it should be called "lest"? As in a less/most replacement written in rust. Although it does divert from the theme of more/less/most.

hulitu 10 hours ago

> A better replacement for mplayer was mpv

YMMV.