Code Monkey home page Code Monkey logo

ghci-color's Introduction

Colorize GHCi

this script colorizes ghci output.

screenshot

  • initial message
  • fundamental operator + - * /
  • parentheses and blackets () {} []
  • double colon operator ::
  • arrow operator -> =>

Requirements

sed (stream editor) or PowerShell

Installation

Clone the repository to local machine:

git clone https://github.com/rhysd/ghci-color.git

Put a script file in $PATH directory:

Run ghci-color instead of ghci.

License

This repository is distributed under the MIT license.

Copyright (c) 2012 rhysd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ghci-color's People

Contributors

digitalguy99 avatar kha-faz avatar moritzkn avatar rhysd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghci-color's Issues

ghci-color halts

The colors in GHCI are awesome, really. But under Ubuntu 13.04, GHCI 7.6.3, I've got an issue: sometimes GHCI stops evaluating. First, it seemed to occure at irregular intervals. But then I found a way to get it broken any time:

in ghci-color, I enter:

[1..]

The evaluation does not end (no printout at all, which is wrong). When I hit Ctrl-C twice, it stops, and GHCI-prompt comes back in scope. But then it keeps broken somehow - I can't evaluate anything anymore, e.g.

1+2

doesn't get any result. Would be great if there would be a way to shift around this... Probably, it is related to gnome-terminal somehow.

My bash environment settings:

COLORTERM=gnome-terminal

TERM=xterm

_terms ()
{
COMPREPLY+=($( compgen -W "$( sed -ne 's/^([^[:space:]#|]{2,})|.*/\1/p' /etc/termcap 2>/dev/null )" -- "$cur" ));
COMPREPLY+=($( compgen -W "$( { toe -a 2>/dev/null || toe 2>/dev/null; } | awk '{ print $1 }' | sort -u )" -- "$cur" ))
}

echo -e flag leaking into output

The -e flag in the echo -e commands appears to be leaking into the output, like so:

$ ghci-color
GHCi, version 7.6.3: http:-e /-e -e /-e www.haskell.org-e /-e ghc-e /-e   :? for help
Loading package ghc-prim ... linking ... -e done.-e 
Loading package integer-gmp ... linking ... -e done.-e 
Loading package base ... linking ... -e done.-e 
Prelude> 

With the flag removed, I still see colored output but no trailing -es:

$ ghci-color                             
GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 

Note that when I enter the following directly in my shell, hello, world is colored (even with the -e flag omitted) but no -e is visible:

$ echo -e '\033[92mhello, world'
hello, world

A very minor issue (that I've fixed on my end anyway), but perhaps you'll know the reason for it off the top of your head.

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.