🐱 catf

… is a syntax-aware version of cat.

#Usage

Install Pygments:

 pip install Pygments

Place catf in a location included in your path and make sure it's executable, ex:

 curl "https://raw.githubusercontent.com/davidfmiller/catf/master/catf > ~/bin/catf
 chmod 700 ~/bin/catf

catf reads from stdio or filenames passed as arguments, ex:

 curl "http://readmeansrun.com/code/readmeansafari/test/json.php" | catf
{
    "array" : [ ],
    "bool" : true ,
    "link" : "http://readmeansrun.com",
    "object" : {
        "string" : "Hello world",
        "number" : 42
    }
}

 catf ~/Documents/git/apples/note
#!/usr/bin/python
# -*- coding: utf-8 -*-

"""
Create a new note from the command-line
"""

import sys
import os
import getopt
import tempfile
import subprocess

def esc(arg):
  """
  Escapes a string's characters

  @param arg (string)
  @return string
  """
  buf = ''
  for i in arg:
    if (i == '\\'):
      buf += '\\\\'
    elif (i == '\n'):
      buf += '<br/>'
    elif (i == '"'):
      buf += '\\"'
    elif (i == ' '):
      buf += '&nbsp;'
    elif (i == '>'):
      buf += '&gt;'
    elif (i == '<'):
      buf += '&lt;'
    else:
      buf += i

  return buf
  ...#

#Options

-d
display (to stderr) which lexer is being used
-v
display version info
-h
display help
-u
open this page (OS X only)
-l {arg}
Force a specific lexer to be used, {arg} can be one of:

#Version History

v0.0.1 - ???
Initial release

#Contribute

Clone it.