7 ms·
Show HN: Gat – cat alternative written in Go
- knoebber 4y agoHas anyone made a "cat" like tool that uses treesitter under the hood?
- johndoe0815 4y agoThey should have called the tool "gato" (Spanish for "cat")...
- AzzieElbab 4y agoand the rust version of cat should have been called "rat" instead of "bat"
- forty 4y agoThe go version could also be called "fat", given the size of go binaries ;)
- ccoreilly 4y ago"Gat" is catalan for "cat"
- nawgz 4y agoIf I read the command `gat myfile` I would definitely assume you were trying to delete it with prejudice. I would be surprised to see it print to my terminal. Edit: why downvotes? You can’t use words as commands that invoke a completely different set of connotations than the commands execution does
- __MatrixMan__ 4y agoGiven that a `gat` has both an input-side and an output-side, I think it resembles `cat` reasonably well. I'd expect some kind of buffering difference so that the output is "faster" than the input in some way.
- jwilk 4y agoWhy delete?
- cosmojg 4y ago"gat" is slang for "shoot and kill (with a gun)"
- netsharc 4y agoLooks like the connotation in your head is really obscure, because the downvoters (I'm guessing), a sibling commenter, and I are wondering why "gat" could mean "delete"?
- morelisp 4y agoIt's slang, but it is well-known slang (and there's not really some other common meaning). https://en.wiktionary.org/wiki/gat#Verb https://en.wiktionary.org/wiki/gat#Verb
- nawgz 4y agoThe dictionary definition of "gat" is "revolver", does that really qualify as "obscure"? Anyways, in terms of usage I've heard, it is almost exclusively implying you'll brandish and/or apply your gun, maybe this part is more obscure, but if I wrote "stab myfile" I don't think you'd expect me to put the contents in a buffer.
- netsharc 4y agoWell I had to check the dictionary to see what you mean. "stab" would be obvious, but maybe someone needs to go out and ask 100 or a 1000 people on the street what they think of when they hear the word "gat", and maybe then you can congratulate yourself for being in an exclusive minority.
- t-3 4y agoI assure you, gat is a common slang, most Americans on the street would be able to tell you that it's a gun.
- nawgz 4y agoPerhaps it's not fully mainstreamed, but looking at the current conversation it looks to me like the idea is widespread. Really though, I also see no other other usages of the term online, it surprises me you would not simply type in "gat" to a search engine and easily understand my point.
- coffee-- 4y agoSimilar to https://github.com/sharkdp/bat https://github.com/sharkdp/bat but Go instead of Rust
- nesarkvechnep 4y agoA missed opportunity to name it `rat`.
- HopenHeyHi 4y agoFlying rat > Earthbound rat Besides, this way I can type 'man bat' and scowl.
- seanw444 4y agoTotally off-topic, but: flying rats are so cute. I didn't realize that until we started getting some that would hang in the alcove, above our door, in the summer occasionally. They aren't really a threat either. As long as you don't go out of your way to bug them, they just sleep cozily. The button noses are great.
- vlugorilla 4y agogat is cat in Catalan: https://lingva.ml/ca/en/gat https://lingva.ml/ca/en/gat
- _8j50 4y agoWhat is the terminal or share they use in screenshots at that readme?
- fabrixxm 4y agoLooks like any terminal with a "▸" as prompt. The rest is the output from bat.
- qbasic_forever 4y agoLooks like fira code font https://github.com/tonsky/FiraCode https://github.com/tonsky/FiraCode and the color scheme is similar to the soft default Alacritty terminal uses https://alacritty.org/ https://alacritty.org/
- hhh 4y agoI always stay strapped with Gat.
- Simplicitas 4y agoGreat to have alternatives, but wish there was a “Why” section in readme
- imoverclocked 4y agoRight, does it do things faster? Or somehow more efficiently? It seems that this is probably slower and consumes far more resources than cat. It also does pretty printing and syntax highlighting. From a Unix standpoint, I would say this is not a cat replacement but a pretty replacement.
- 5e92cb50239222b 4y agoI just tried both gat and bat to see if they could really replace cat (spoiler: they cannot — unlike cat they soak up all input before outputting anything, and crash with out of memory very quickly). A cat alternative would have to handle this correctly: $ </dev/zero cat >/dev/null or it's not really a cat alternative. (Yes, variations on this theme are very useful in scripts and daily shell hacking).
- morelisp 4y agoThat's wild given that Go makes it harder to read a whole file than read a block at a time.
- nasretdinov 4y agoOh, absolutely not! ioutil.ReadFile and you're done!
- Patrickmi 4y agoAt least we know the problem and the solution to it
- skulk 4y agoHere is where the file is read in its entirety. https://github.com/koki-develop/gat/blob/c16dbf999b89b46ed17f5acf94e2250a97b8dcfc/pkg/printer/printer.go#L85-L88 https://github.com/koki-develop/gat/blob/c16dbf999b89b46ed17...
- deleted 4y ago[deleted]
- awestroke 4y agoI'll stick to bat
- jpe90 4y agoI would be curious to see how it compares to similar tools: https://github.com/sharkdp/bat/blob/master/doc/alternatives.md https://github.com/sharkdp/bat/blob/master/doc/alternatives....
- rascul 4y agoNitpick about bat: it bothers me that they call it a drop in cat replacement. It is not. But it's a very useful tool that I use often. I'm not familiar with ccat but at a quick glance it does not appear to be a drop in cat replacement either.
- noughtme 4y agoI’ve been using ccat (colorized cat) for a while, but this looks good too. https://github.com/owenthereal/ccat https://github.com/owenthereal/ccat
- deleted 4y ago[deleted]
- przemub 4y agoBoth gat and bat seem more like a replacement for less, not cat to me!
- bilinguliar 4y agoU-root implementation: https://github.com/u-root/u-root/blob/main/cmds/core/cat/cat.go https://github.com/u-root/u-root/blob/main/cmds/core/cat/cat...
- quickthrower2 4y agocat -v is ”harmful” but this is fun, well done!