Git Product home page Git Product logo

Comments (7)

mvdan avatar mvdan commented on August 23, 2024

Is it a common pattern for all unix tools that work with stdin/stdout to also accept files as arguments? I don't see why it shouldn't be supported, but just wondering.

I'm also thinking about multiple files. I'm guessing you would have xurls file1 file2 work just like cat file1 file2 | xurls, as in without distinguishing files?

from xurls.

mvdan avatar mvdan commented on August 23, 2024

Also, of course the tool hanging when given an argument is a bug :)

from xurls.

bep avatar bep commented on August 23, 2024

Most (all?) of the *nix tools in the GNU Utils package that works on text works on files + stdin, cat, grep, more, less, tail ... So it's common. So common it was the first my fingers tried.

Ideally it should work like cat does, so xurls file1 file2 xurls *.txt etc should work (maybe spin up some Go routines to make it snappier).

from xurls.

mvdan avatar mvdan commented on August 23, 2024

Done. I've followed the pattern that cat uses, explained in the commit for future reference.

from xurls.

mvdan avatar mvdan commented on August 23, 2024

I just noticed your mentioning of goroutines. For multiple files it could be used. They are cheap so that shouldn't be a problem, and it could indeed speed things up for large files or async I/O.

The only disadvantage I can think of is that the urls will no longer be output in the correct order like cat prints the lines in order, even though at no point we say we're doing them in order.

from xurls.

bep avatar bep commented on August 23, 2024

The go routines would be a nice addon (not important), but is a different issue.

from xurls.

mvdan avatar mvdan commented on August 23, 2024

Could you please open a separate issue describing it?

from xurls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.