Skip to content

Linux command-line utility to print files with syntax highlighting. Just like cat, but with colors.

Notifications You must be signed in to change notification settings

Greece4ever/scat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scat

Very simple linux command-line utility to print files with syntax highlighting. Just like cat, but with colors.

GIF Demo

Installation

scat can be installed with either of the following ways

  1. Build from source, then execute an install.sh script
  2. Install the binary, then execute a similar install.sh script

1. Building Source

The source can be built with a verison ofg++ that supports c++17. The default that comes with apt-get should be fine.

sudo apt install g++

aditionally the sqlite3 library files are required

sudo apt-get install libsqlite3-dev

then you can clone and execute the install.sh script which does some minor configurations

git clone https://github.com/Greece4ever/scat.git
cd scat
. ./install.sh

Then, if everything goes right, there should be an executable in the same directory called scat.

Optionaly you can then move it to /usr/bin

sudo mv scat /usr/bin # or better /usr/local/bin

2. Installing built binary (Alternative)

Installing the already built binary also requires some configuration.

Install and extract the zip from the tag release. Assuming curl and unzip are installed.

curl --output scat.zip -L -get https://github.com/Greece4ever/scat/releases/download/0.0.0/scat.zip
unzip scat.zip > /dev/null

Then execute the install.sh script

# cd scat # you may have to do this if you install via browser
cd build 
. ./install.sh
sudo mv ./scat /usr/bin # or /usr/local/bin

if you've moved to /usr/bin/ or /usr/local/bin You can safely remove the source files with cd .. && rm -rf ./scat.

Usage

Assuming you've run the install script and everything went smoothly.

scat ./file # Print file with syntax highlithing

This will use the default syntax highlighting that came with with repository.

To add your own

scat --parse --save file.lang # print all the colors and save
scat --save file.lang  # simply save

Were a .lang file has the following format

.cpp

KWD:
    int BLUE
    float BLUE
RPT:
    */   /*   GREY
    //    \n  GREY
    "     "   GREEN

The first thing must be the file extension (.cpp here). KWD stands for keyword and it represent language keywords (e.g def in python) and RPT stands for repeating keywords, which is for things like string quotes (", ') where everything between them is Green. Other example files can be found here.

If no syntax highlithing is found for a specific format, the default will be used (which is set in the install.sh script) and it can be set via.

scat --default ./default.lang

Languages who have similar (or the same) syntax highlithing rules don't have to be --saved again. If you already have --saveed for example .py you can do this for .pyc files

scat --create_ptr .py .pyc # .pyc points to .py

About

Linux command-line utility to print files with syntax highlighting. Just like cat, but with colors.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published