Code Monkey home page Code Monkey logo

Comments (2)

robd avatar robd commented on May 26, 2024

I'm not sure - my gut feeling is that it's simpler not to add the colors in the first place if they are not needed, but perhaps this has downsides I haven't thought of.

One difference is that in the SSHKit approach, colors wouldn't be stripped from output of other commands called by SSHKit. I can't work out if this is a benefit or disadvantage. If I understand correctly, Airbrussh's config.color = false option strips the colors from the output of commands run by SSHKit. This could be useful if users want the formatter to do this but I'm not sure if that is a common use case.

The changes I made recently continue to allow SSHKit users to force colors to be on, but do not allow users to force them to be off. Since these haven't been released I'm not sure if there are use cases where users want to be able to force the colors to be off even though their output has a tty associated with it. Personally I would be in favour of adding support for the Airbrussh color config options to SSHKit. This was disussed a bit here: capistrano/sshkit#245, but things have moved on quite a bit, so maybe worth discussing again.

If we did add that new option, then in a future major release I would like to remove this colorize override in the SimpleTextFormatter. This would leave a single method - format_message on the SimpleTextFormatter. I think this could be reimplemented as 2 config options on the Pretty formatter:

  1. Whether to show the command UUID
  2. Whether to show the log level prefix (eg INFO, WARN etc)

The SimpleTextFormatter output is the same as the pretty formatter, but with each of these components omitted.

I realise all of this isn't really helping with the mission of making Airbrussh the default Capistrano formatter, but I think, if it makes sense, it would be good if Airbrussh could be configured by using the same options as SSHKit.

If we wanted to reuse the SSHKit color support, then one approach would be to use the colorize method from the abstract formatter, but without adding support for config.color = :true | :false | :auto, this would be a retrograde step for Airbrussh I guess.

I'm not sure if this helps at all? :(

from airbrussh.

mattbrictson avatar mattbrictson commented on May 26, 2024

I don't think this refactor is necessary. Sharing the Colors implementation between SSHKit and Capistrano further couples the internals of the two gems, with not much benefit.

from airbrussh.

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.