codesections is a user on fosstodon.org. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
codesections @codesections

Just discovered , a drop-in replacement for the Unix `cat` command. It supports automatic paging, line numbers, and syntax highlighting, and it is extensible with custom color schemes.

github.com/sharkdp/bat/

-tools

`cat` `bat`

Β· 7 Β· 18

@codesections That's an interesting take on cat. It would be useful for dumping short bash scripts in the terminal. Sounds like it's just a feature or two short of being an editor. MIT and Apache licenses together?

@codesections Nice find.. and for any Archers out there it's in the community repo as 'bat'.

@codesections I think that was Popey's Command Line Looove in this last edition of the Ubuntu Podcast."Bat is cat with wings".

@codesections looks neat! I wonder if it works the same than cat on file instead of terminals.

@codesections I guess I'll be the voice of reason here: this is incredibly dumb

@aminb @codesections cat is one of the smallest and simplest utilities ever. It's also standardized. This is the opposite of the unix way, just pipe things into less. less -R will pass through ANSI escape codes so your terminal renders syntax highlighting too.

@sir @codesections

> cat is one of the smallest and simplest utilities ever.

Hmm, bat is about 1.6 kLOC, and cat from GNU Coreutils is about 770 LOC. So I'm not sure how well your argument about size stands. Sure, OpenBSD cat is about 250 LOC, but they're all basically within the same order of magnitude.

> It's also standardized.

Sure. But I don't think the author was suggesting bat as a universal replacement for cat. Rather as a nice alternative that whoever wishes can install for themselves. Who knows, if Rust continues growing it *might* come a day where utils written in Rust find their way into core packages of distros.

> This is the opposite of the unix way, just pipe things into less.

Being a GNU Emacs diehard who does just about everything (aside from web browsing) in Emacs, I'm clearly biased and don't really buy into the whole "unix philosophy", but that's just me.

> less -R will pass through ANSI escape codes so your terminal renders syntax highlighting too.

That's a handy thing to know, thanks. Though, as I mostly use Emacs for browsing local or remote (using Tramp) files/dirs/man pages, I rarely find myself using less.

@aminb @codesections
GNU cat is dumb and implements loads of very dumb extensions

Try this on for size:

git.suckless.org/sbase/tree/ca

This is POSIX compatible.

I don't have anything to say regarding the rest of your comments.

@sir @codesections

Ah, good ol' suckless.. I guess our notions of dumb vary quite a bit, but that's alright. Thanks for the link and discussion.
@aminb @sir @codesections

yeah, so less(1) exists, most(1) exists, vi/vim exist (vim has a readonly view(1) alias as well), and emacs exists

they all support line numbers, they all support paging, some support syntax highlighting and custom colour schemes

this reminds me of that replacement for ls which was also written in rust

@wowaname @aminb @codesections remember that "cygwin replacement" which was just crappy implementations of some GNU coreutils and a non-ANSI terminal emulator

@sir @codesections @aminb no, but searching i see "gnu on windows". is that it?

only other thing i know is git's bash environment which is handy if you dont want to install all of cygwin

@wowaname @codesections @aminb well I don't use Windows so I've never actually used it

But the point of cygwin is that it is a POSIX environment, not that it provides a Unix-like shell

Just another example of missing the point

@wowaname @sir @codesections

factually true statements, but i can't see the point you're making.
@aminb @sir @codesections the point is dont claim to be an alternative of cat when theres only one true implementation of cat
@wowaname @sir @codesections which do you consider to be "the one true implementation of cat"? the suckless one? the OpenBSD one?
@aminb @sir @codesections sorry i meant type of implementation, as in: take argv as a list of files and concatenate them in order, to stdout

no flags
no other features
just one thing
@aminb @sir @codesections just like when i run true(1) with the flag -f i dont magically get a false return value
@wowaname @sir @codesections

Right, but I presume this reasoning comes from the "unix philosophy". I don't think GNU coreutils were written with adhering to the unix philosophy in mind, and at some point those flags were deemed useful to be added to the GNU implementations. These projects/implementations were created with different philosophies in mind, and therefore vary in functionality, but I don't think that makes one 'dumber' or 'smarter' than another.

@aminb @wowaname @codesections proliferating nonstandard tools is objectively dumb because they encourage scripts et al which do not work on new platforms and make the work of porting more burdensome for hugely questionable "gains"

@aminb @sir @codesections GNU codebases are generally objectively unreadable trash so i dont know what youre trying to prove with that

@wowaname @aminb @codesections that too, GNU code is really fucking bad, almost as bad as GNOME code

@wowaname @aminb @sir @codesections Also "cat came back from BSD with waving flags", so even *BSD probably aren't the best Unix-style implementation.
@lanodan @aminb @sir @codesections use suckless cat or busybox cat configured correctly upon building it

i said nothing about using bsd's implementation and nor did sircmpwn

remember kids, bandwagon argument is a fallacy. just because everyone does it doesnt make it suddenly right
@wowaname @sir @codesections Not sure I agree with "unreadable trash", but I see your point. There's historical reasons why they're written this way, but that doesn't justify the code quality. Still, they continue to be used on millions of machines. The code quality can be improved but I personally don't classify that as trash.

@aminb @wowaname @codesections Windows is used on even more machines than that. Popularity has nothing to do with being good

@sir @codesections @wowaname Most definitely. I wasn't trying to argue that.
@aminb @sir @codesections from what i remember, glibc looked like hieroglyphics compared to musl

but i'll see if i can find their justications and maybe read more of their code

@wowaname @aminb @codesections bad code is everywhere. I take a more fundamental objection with GNU software because it prioritizes things like an unnecessary level of performance over simple, stable code; and because it encourages bad practices by implementing and using extensions on every standard it touches (ref bash, coreutils, gcc, glibc, etc)

@wowaname @aminb @codesections the bad code is to some extent a reflection of these warped priorites. Simple code could not achieve the braindead goals they set for themselves.

@sir @aminb @codesections I was hong to ask: how does this compare to less -FX?