Code Monkey home page Code Monkey logo

Comments (2)

malxau avatar malxau commented on August 31, 2024

Thanks for the report.

I'll probably end up doing the simple thing, but I'm asking in case you can see a "better" alternative. Outside of tee, this would normally be solved with pipes. Specifically, cvtvt -text can be used to strip VT escapes. Unfortunately that doesn't work for tee, which is writing to a file directly and has no way to insert pipes into that stream.

So, considering that this is open source, there's a single repo that implements piping and execution that also has tee. It seems like it ought to be possible for tee to support pipes on the file stream, and the challenge is inventing a syntax to let it do so that doesn't create more problems than it solves.

Would it make sense to be able to do something like:
df | tee -c "cvtvt -text" file
?

Another option would be to optionally invert tee's behavior. Currently tee writes to a file (without pipe support), and writes to stdout (which can be further piped.) An inverted tee would write to the display (without pipe support) and write to stdout (which can be further piped, ultimately to a file.)

Part of the reason I'm asking is because I think there are other operations that make sense to perform on the file as well (eg. iconv.)

Of course, there may be other options too. Do you see any more generic/elegant approach to this aside from hardcoding one specific operation into tee?

from yori.

JimF42 avatar JimF42 commented on August 31, 2024

While I think the idea of having the double pipe sounds cool, to be able to pipe to cvtvt first, I will have to leave that decision up to you because of effort needed.

I'm really new to using Yori, so I can't say right now how else I would use the new piping engine that would be required to do this for tee

As far as inverting tee, that bothers me a bit as tee in general is so well known, that it may be confusing to some, and no longer backwards compatible for existing users. If you did this, you would either need a new command to avoid confusion, or, a non-default set of switches that inverts the default behavior.

In some ways, I think your example of df | tee -c "cvtvt -text" file makes the best sense if you are not going to simply "hardcode" the cvtvt features into tee.

Otherwise, it would probably be something like df | tee -c[onsole] | cvtvt -text file, if you want to allow for an inverted tee (if that's even possible since they will both ultimately be going to the console).

from yori.

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.