Code Monkey home page Code Monkey logo

hicat's Introduction

hicat 🐱

image

cat with syntax highlighting. The language is auto-detected through the file extension.

hicat index.js

Pipe something to hicat. The language will be inferred from the contents.

curl http://example.com | hicat

If hicat fails to detect a language, specify it using -l LANG.

curl http://example.com | hicat -l xml

Status

Installation

npm install -g hicat

npm version

Usage:

$ hicat --help

  Usage:
      hicat [options] FILE
      ... | hicat [options]

  Options:
      -h, --help         print usage information
      -v, --version      show version info and exit
      -l, --lang LANG    use a given language
          --languages    list available languages
          --no-pager     disable the pager

Tips and tricks

Add an alias to your ~/.bashrc to save a few keystrokes.

alias hi=hicat

Btw

highlight.js powers the syntax highlighter engine.

Thanks

hicat © 2014+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors.

ricostacruz.com  ·  GitHub @rstacruz  ·  Twitter @rstacruz

hicat's People

Contributors

antonydevanchi avatar hoobdeebla avatar kidonng avatar linusu avatar mohsen1 avatar rstacruz 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  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  avatar  avatar

hicat's Issues

Make it possible to do `alias cat=hicat`

Just came across this and the first thing I thought was that I can maybe (finally) use a seamless alias for cat. Unfortunately, after a hicat --help, I realized this is not possible as cat -n == hicat -N.

IMHO supporting cat's options would make this a lot more useful, filling the void where other "cat replacements" (highlight, src-highlite, pygmentize, etc...) fall a bit short.

Most of cat's (small set of) options are not taken up by hicat. I think that -n and -e are the most popular.

Thoughts?

Version 0.8.0 broke quotes

In version 0.8.0, all double quotes are replaced with ", and all single quotes are replaced with '.

image

Different Styles

There should be the possibility to select different styles for highlighting.
Highlight.js seems to have quite a decent collection.
The hicat default theme is pretty lame in my opinion.

Dealing with empty files

Right now hicat doesn't handle empty files correctly while cat does:

$ touch some_file
$ cat some_file 
$ hicat some_file 
/usr/local/lib/node_modules/hicat/index.js:38
  if (!out || !out.value) throw new Error("failed to highlight");
                          ^

Error: failed to highlight
    at hicat (/usr/local/lib/node_modules/hicat/index.js:38:33)
    at /usr/local/lib/node_modules/hicat/bin/hicat:82:20
    at Array.forEach (native)
    at /usr/local/lib/node_modules/hicat/bin/hicat:77:9
    at read (/usr/local/lib/node_modules/hicat/lib/read.js:59:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/hicat/bin/hicat:75:1)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)

Would be great if this use case could be fixed.

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.