Giter Site home page Giter Site logo

colour's Introduction

Colour

Add colour to command line application's output using config file.

e.g. nodetool status

xss =  -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms3971M -Xmx3971M -Xmn800M -XX:+HeapDumpOnOutOfMemoryError -Xss256k
Datacenter: DC1
======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address      Load       Tokens  Owns   Host ID                               Rack
UN  10.0.200.9   26.11 GB   256     5.4%   613d2143-0829-4fcc-8614-c2aa24007805  I6
UL  10.0.201.5   29.42 GB   256     5.1%   eb1b2b11-6856-4562-9c7c-03862fb5480f  G0
DN  10.0.202.8   32.29 GB   256     5.1%   7ecc8db9-9e9e-4000-98f4-e2441744a94b  I7
DL  10.0.203.6   25.27 GB   256     4.5%   114ba6d6-2c4e-4dd5-8cac-96725ec9a6ed  I6

using

<?xml version="1.0"?>
<input>
    <!--Datacenter label-->
    <line match="^Datacenter: (.+)">
        <part colour="default">1</part>
    </line>

    <!-- UP NORMAL -->
    <line match="^(UN)(.+)">
        <part colour="green">1</part>
        <part colour="default">2</part>
    </line>

    <!-- UP NOT NORMAL -->
    <line match="^(U[^N])(.+)" colour="yellow"/>

    <!--DOWN-->
    <line match="^(D[A-Z])(.+)" colour="red"/>
</input>

will colour down nodes fully red, non-normal nodes fully yellow and just the status of up nodes green.

Usage

nodetool status | ./colour --cfg=cfg/nodetool_status.xml

colour's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.