arsham / blush Goto Github PK
View Code? Open in Web Editor NEWGrep with colours
License: MIT License
Grep with colours
License: MIT License
At the moment, WriteTo()
function uses bufio.Scanner()
with a custom buffer and a large token size in order to read from readers line by line, which is not ideal. On the other hand, Read()
uses a bytes.Buffer
instance and reads everything on first call. Both of these methods require refactoring.
This method should request the next available line or more if required (2), and call Find()
methods of all finders, keeping the results in a buffer. Then it should write up to length of given io.Writer
, while keeping the rest of the buffer for the next try, until it processes everything.
This method shares most of WriteTo()
's logic.
io.Copy()
uses WriteTo
if available, then Read()
method.Blush
struct, which is either os.Stdin
or reader.MultiReader
and when its Read()
method is called, it automatically closes previously processed reader and opens the next one. Therefore there is no action required here.reader.MultiReader
usage, if any filed isn't ended with a new line and readers rotate, it should account for a new line in between operations.Just a suggestion but you might want to switch to a simpler prompt for your screenshots. The one you're using is cool and everything but a little distracting when we really just want to see how the results are getting colored.
I have Debian 9 Stretch and go get doesn't work
$ go version
go version go1.7.4 linux/amd64
$ go get github.com/arsham/blush
# github.com/arsham/blush/cmd
opt/go/src/github.com/arsham/blush/cmd/args.go:78: undefined: sort.SliceStable
opt/go/src/github.com/arsham/blush/cmd/args.go:118: undefined: sort.SliceStable
opt/go/src/github.com/arsham/blush/cmd/args.go:122: undefined: sort.SliceStable
SliceStable seems to be introduced with 1.8, https://golang.org/doc/go1.8 ? So maybe the readme needs an update?
No help flag available from the CLI. Can't expect people to continually reference the github docs.
Any reason not to do this? If not I'll look at it and put in a PR this weekend.
Could you explain how to install/run?
I've already installed golang... what then, I'm on ubuntu, but i suppose it's quite similar for everyones go installation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.