Linux: ccat

The ccat command I created for Linux – written in Pascal – types files to screen like the cat command does, except it runs the files through a color filter. An example of the output for a small XML file and a small Pascal file is shown below.

Two examples of ccat output

In order to try out ccat you first need to do a:

git clone https://github.com/sith-ikjetil/ccat.git

Then you need to have the free pascal compiler installed in order to compile the application. You install it on Ubuntu like this:

sudo apt install fpc

Then you navigate to the ./ccat/src directory and run the build.sh build script. After the build is finished you have a ccat executable and you can put it in a bin folder that is part of your path. For example /usr/bin or ~/bin if you have your own bin directory in your home directory.

Next you must create a directory in your home folder called .ccat (~/.ccat). Copy all .ccrc files from source directory ./ccat/ccrc/ to this directory.

This is all you need to have files colorized with output. There are now a small number of supported file types with their own color configuration. These are: .arduino, .asm, .c (includes .c, .cpp and .h), .cs, .js, .json, .pascal, .perl, .sh, .text, .xml. If a file does not have a corresponding ccrc file it defaults to the .text color filter file. Also these color configuration files are not all completely finished. The .asm for example does not have all instructions or registers included among other things. It is all a work in progress.

You can override the ccat command with --syntax=<first name of ccrc filename> if you need to specify the syntax it should use.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: