Giter Site home page Giter Site logo

Comments (5)

bluemoon avatar bluemoon commented on July 17, 2024

You could go as far as something like this:

class NullStream:
    def write(self, text):
        pass

import sys
sys.stdout = NullStream()

from lettuce.

gabrielfalcao avatar gabrielfalcao commented on July 17, 2024

Actually, the feature I'm thinking to implement on couleur is pretty much it :)
Thanks

from lettuce.

rudylattae avatar rudylattae commented on July 17, 2024

My 2 pesos:

Please consider the fact that the Winblows shell (aka dos prompt) does not understand *nix color codes. I got lettuce installed and fired it up and guess what I saw... the cryptic stuff below!

←[1;31mOops!←[0m
←[1;37mcould not find features at ←[1;33m\features←[0m

I quickly jumped into cygwin (the poor-man's *nix on Winblows) and saw a nicely colored output saying:

Oops!
could not find features at ./features

The "Oops!" was in red. The "could not find..." was bright white and the "./features" was in yellow. The garbled message I got in the dos shell earlier was just a nicely colored output -- visible only in a *nix shell.

Digging through the code I noticed that lettuce uses plugins to handle output -- AWESOME! On a Win machine the only solution is to just spit stuff out without any color codes. From what I saw in the lettuce code, it selects the output handler based on the verbosity level passed in:

-v VERBOSITY, --verbosity=VERBOSITY

So if I run lettuce with a verbosity level of 0, it loads the non_verbose plugin. If I run it with a verbosity level of 3, it loads the shell_output plugin. Both these plugins output straight text without any coloring. Any other verbosity level (and if no level is specified), the output is handled by the colored_shell_output plugin.

I'm sure by now you can see that the only way for a poor Winblows developer like myself to get any real benefit out of lettuce is to pass it a verbosity level "3". If the shell_output plugin is "improved" to always output in color the Python-Winblows universe may very well collapse in on itself! Ok, ok, I guess that's an exaggeration but you get my point.

So Gaberiel, my suggestion is that if you want to implement color support for verbosity level 3 (and I think that is a good thing), please consider implementing such that it can be turned on/off as needed. In fact a very good pattern for the color feature is to make it possible to toggle it independently of the verbosity level.

Thanks and keep up the awesome work.

from lettuce.

gabrielfalcao avatar gabrielfalcao commented on July 17, 2024

I'm gonna make couleur support windows

from lettuce.

gabrielfalcao avatar gabrielfalcao commented on July 17, 2024

shell output using couleur, closed by 8894b9d

from lettuce.

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.