pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/textproc/colorit colorit is a simple utility for color...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ba4c40f3b4dd
branches:  trunk
changeset: 603749:ba4c40f3b4dd
user:      cheusov <cheusov%pkgsrc.org@localhost>
date:      Sat May 12 15:15:35 2012 +0000

description:
colorit is a simple utility for colorizing input texts

diffstat:

 textproc/colorit/DESCR                        |    2 +
 textproc/colorit/MESSAGE                      |    9 +
 textproc/colorit/Makefile                     |   33 ++++
 textproc/colorit/PLIST                        |   21 +++
 textproc/colorit/files/.colorit.d/aptget      |   16 ++
 textproc/colorit/files/.colorit.d/changelog   |   10 +
 textproc/colorit/files/.colorit.d/colors      |   33 ++++
 textproc/colorit/files/.colorit.d/configure   |    7 +
 textproc/colorit/files/.colorit.d/dict        |   38 +++++
 textproc/colorit/files/.colorit.d/diff        |   17 ++
 textproc/colorit/files/.colorit.d/gcc         |    1 +
 textproc/colorit/files/.colorit.d/ldbunittest |   40 +++++
 textproc/colorit/files/.colorit.d/ls          |   64 +++++++++
 textproc/colorit/files/.colorit.d/make        |   51 +++++++
 textproc/colorit/files/.colorit.d/patch       |    9 +
 textproc/colorit/files/.colorit.d/ps          |    7 +
 textproc/colorit/files/.colorit.d/pstree      |    7 +
 textproc/colorit/files/.colorit.d/stardict    |   22 +++
 textproc/colorit/files/.colorit.d/ts          |    6 +
 textproc/colorit/files/.colorit.d/wdiff       |    7 +
 textproc/colorit/files/colorit_aliases        |   22 +++
 textproc/colorit/files/colorit_funcs          |  178 ++++++++++++++++++++++++++
 22 files changed, 600 insertions(+), 0 deletions(-)

diffs (truncated from 688 to 300 lines):

diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/DESCR    Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,2 @@
+colorit(1) is a simple utility for colorizing text input
+using escape sequences.
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/MESSAGE
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/MESSAGE  Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,9 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2012/05/12 15:15:35 cheusov Exp $
+
+How to use example files:
+- cp -Rp ${PREFIX}/share/examples/colorit/.colorit.d ~
+- cp ${PREFIX}/share/examples/colorit/colorit_* ~
+- echo '. ~/colorit_aliases' >> ~/.shrc
+
+===========================================================================
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/Makefile Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,33 @@
+# $NetBSD: Makefile,v 1.1.1.1 2012/05/12 15:15:35 cheusov Exp $
+
+.include "../../textproc/dict-server/Makefile.common"
+
+PKGNAME=       ${DISTNAME:S/dictd/colorit/}
+CATEGORIES=    textproc
+COMMENT=       Utility for coloring output
+
+LICENSE=               public-domain
+
+USE_TOOLS+=            gawk:run
+
+INSTALLATION_DIRS+=    bin ${PKGMANDIR}/man1 ${EGDIR} ${EGDIR}/.colorit.d
+
+EGDIR=                 ${PREFIX}/share/examples/colorit
+
+DISTINFO_FILE= ${.CURDIR}/../../textproc/dict-server/distinfo
+PATCHDIR=      ${.CURDIR}/../../textproc/dict-server/patches
+
+do-build:
+       set -e; cd ${WRKSRC}; \
+       sed 's|@sysconfdir@|${PKG_SYSCONFDIR}|' colorit.in > colorit; \
+       sed 's|@SYSCONFDIR@|${PKG_SYSCONFDIR}|' colorit.1.in > colorit.1; \
+       chmod +x colorit
+
+do-install:
+       set -e; cd ${WRKSRC}; \
+       ${INSTALL_SCRIPT} colorit ${DESTDIR}${PREFIX}/bin; \
+       ${INSTALL_MAN} colorit.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1; \
+       cp ${.CURDIR}/files/colorit_* ${DESTDIR}${EGDIR}/; \
+       cp -R ${.CURDIR}/files/.colorit.d ${DESTDIR}${EGDIR}/
+
+.include "../../mk/bsd.pkg.mk"
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/PLIST    Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,21 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2012/05/12 15:15:35 cheusov Exp $
+bin/colorit
+man/man1/colorit.1
+share/examples/colorit/.colorit.d/aptget
+share/examples/colorit/.colorit.d/changelog
+share/examples/colorit/.colorit.d/colors
+share/examples/colorit/.colorit.d/configure
+share/examples/colorit/.colorit.d/dict
+share/examples/colorit/.colorit.d/diff
+share/examples/colorit/.colorit.d/gcc
+share/examples/colorit/.colorit.d/ldbunittest
+share/examples/colorit/.colorit.d/ls
+share/examples/colorit/.colorit.d/make
+share/examples/colorit/.colorit.d/patch
+share/examples/colorit/.colorit.d/ps
+share/examples/colorit/.colorit.d/pstree
+share/examples/colorit/.colorit.d/stardict
+share/examples/colorit/.colorit.d/ts
+share/examples/colorit/.colorit.d/wdiff
+share/examples/colorit/colorit_aliases
+share/examples/colorit/colorit_funcs
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/aptget
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/aptget  Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,16 @@
+include(HOME/.colorit.d/colors)
+
+changequote([[, ]])
+changequote([[``]], [['']])
+
+mark "^E:.*$"                   fg_ltred  col_normal
+mark "Could not connect to"     fg_ltred  col_normal
+mark "Failed to fetch"          fg_ltred  col_normal
+
+mark "Preparing to replace"     fg_yellow col_normal
+
+mark "Unpacking"      fg_yellow col_normal
+mark "Setting up"     fg_yellow col_normal
+mark "Setting up"     fg_yellow col_normal
+
+mark "[[:alpha:]][[:alnum:]]+ [[:digit:]][[:alnum:].-]+"  fg_white col_normal
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/changelog
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/changelog       Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,10 @@
+include(HOME/.colorit.d/colors)
+
+changequote([[, ]])
+changequote([[``]], [['']])
+
+mark "^[[:alnum:]].*$"  fg_white col_normal
+mark "^[[:space:]]--.*" fg_yellow col_normal
+mark "_[[:alnum:]]+_"   fg_yellow col_normal
+mark "^[*][[:space:]]"  fg_white  col_normal
+mark "^--------------+" fg_white  col_normal
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/colors
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/colors  Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,33 @@
+define(`fg_black',    `\033[0;30m')
+define(`fg_red',      `\033[0;31m')
+define(`fg_green',    `\033[0;32m')
+define(`fg_brown',    `\033[0;33m')
+define(`fg_blue',     `\033[0;34m')
+define(`fg_purple',   `\033[0;35m')
+define(`fg_cyan',     `\033[0;36m')
+define(`fg_licyan',   `\033[0;37m')
+
+define(`fg_gray',     `\033[1;30m')
+define(`fg_ltred',    `\033[1;31m')
+define(`fg_ltgreen',  `\033[1;32m')
+define(`fg_yellow',   `\033[1;33m')
+define(`fg_ltblue',   `\033[1;34m')
+define(`fg_ltpurple', `\033[1;35m')
+define(`fg_ltcyan',   `\033[1;36m')
+define(`fg_white',    `\033[1;37m')
+
+define(`bg_black',  `\033[0;40m')
+define(`bg_red',    `\033[0;41m')
+define(`bg_green',  `\033[0;42m')
+define(`bg_yellow', `\033[0;43m')
+define(`bg_blue',   `\033[0;44m')
+define(`bg_purple', `\033[0;45m')
+define(`bg_cyan',   `\033[0;46m')
+define(`bg_white',  `\033[0;47m')
+
+define(`col_underline', `\033[04m')
+define(`col_brighten',  `\033[01m')
+
+define(`col_normal', `\033[1;0m')
+
+#define(`fg_white', `\033[1m')
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/configure
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/configure       Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,7 @@
+include(HOME/.colorit.d/colors)
+
+changequote([[, ]])
+changequote([[``]], [['']])
+
+mark " no *$"  fg_white col_normal
+mark "^[.] *$" "fg_white .---------------------------------------------------" col_normal
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/dict
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/dict    Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,38 @@
+include(HOME/.colorit.d/colors)
+
+changequote([[, ]])
+changequote([[``]], [['']])
+
+mark "From.*" fg_white col_normal
+mark "^ +_[IVXLC]+" fg_white col_normal
+mark "^ +[0-9]+[.>]" fg_white col_normal
+mark "^ +[0-9]+[:]" fg_green col_normal
+mark "_[^ ]+[.]"    fg_ltblue col_normal
+
+mark [{][^{}]+[}] fg_yellow col_normal
+mark ^[[:space:]][0-9][0-9]?[:).] col_brighten fg_cyan
+mark NAME               fg_white col_normal
+mark SYNOPSIS           fg_white col_normal
+mark "([[:upper:]]+ )?DESCRIPTION"        fg_white col_normal
+mark RETURN.*VALUE      fg_white col_normal
+mark ERRORS             fg_white col_normal
+mark APPLICATION.*USAGE fg_white col_normal
+mark SEE.*ALSO          fg_white col_normal
+mark EXAMPLES           fg_white col_normal
+mark DERIVATION         fg_white col_normal
+mark FUTURE.DIRECTIONS  fg_white col_normal
+mark OPTIONS            fg_white col_normal
+mark OPERANDS           fg_white col_normal
+mark "INPUT FILES"      fg_white col_normal
+mark "OUTPUT FILES"     fg_white col_normal
+mark "ENVIRONMENT VARIABLES" fg_white col_normal
+mark HISTFILE                fg_white col_normal
+mark STDIN                   fg_white col_normal
+mark STDOUT                  fg_white col_normal
+mark STDERR                  fg_white col_normal
+mark " ENV( |$)"             fg_white col_normal
+mark "ASYNCHRONOUS EVENTS"   fg_white col_normal
+
+mark w?(void|long|char|unsigned|int)([[:space:]_]).*; fg_cyan col_normal
+
+mark `ine bg_` `fg_green+ +<green>` `</green>+ +col_normal`
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/diff
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/diff    Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,17 @@
+include(HOME/.colorit.d/colors)
+
+changequote([[, ]])
+changequote([[``]], [['']])
+
+# for unified output format
+mark "^Index:.*$"       fg_white col_normal
+mark "^==============+" fg_white col_normal
+mark "^[-][-][-].*$"    fg_white col_normal
+mark "^[+][+][+].*$"    fg_white col_normal
+mark "^[+].*$"          fg_green col_normal
+mark "^[-].*$"          fg_red   col_normal
+
+# for default output format
+mark "^[>].*$"           fg_green col_normal
+mark "^[<].*$"           fg_red   col_normal
+mark "^[0-9].*$"         fg_white   col_normal
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/gcc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/gcc     Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,1 @@
+include(HOME/.colorit.d/make)
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/ldbunittest
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/ldbunittest     Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,40 @@
+#
+# COLORING OF LDB UNIT TEST OUTPUT
+#
+# Instructions:
+#
+# 1) place this file in your home directory 
+# 2) add the below code to your ~/.alias file
+#
+# if test -f ~/.colorit.d/ldbunittest; then
+#
+#      UNIT_TEST_PROG=`which run_ldb_unit_test.rb`
+#      
+#      function run_ldb_unit_test.rb (){
+#              if test -t 2; then
+#                      "$UNIT_TEST_PROG" "$@" 3>&1 2>&1 1>&3 | colorit -P - -c ~/.colorit.d/ldbunittest 3>&1 2>&1 1>&3
+#                      awk "BEGIN {exit ${PIPESTATUS[0]}}"
+#              else
+#                      "$UNIT_TEST_PROG" "$@"
+#              fi
+#      }
+#      
+# fi
+#
+
+
+include(HOME/.colorit.d/colors)
+
+changequote([[, ]])
+changequote([[``]], [['']])
+
+mark "^case_(start|end)"                     fg_white col_normal
+mark "^(input|etalon|actual)(_(start|end))?" fg_yellow  col_normal
+mark "^(source file|description|state|id)"   fg_green   col_normal
+
+mark "\tFAILED$"          fg_red   col_normal
+mark "^Failures: [1-9].*" fg_red   col_normal
+mark "^Tests:.+"          fg_red   col_normal
+
+mark "\tSUCCESS$"         fg_green col_normal
+mark "^Failures: 0"       fg_green col_normal
diff -r 36ac6a4831c8 -r ba4c40f3b4dd textproc/colorit/files/.colorit.d/ls
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/textproc/colorit/files/.colorit.d/ls      Sat May 12 15:15:35 2012 +0000
@@ -0,0 +1,64 @@
+include(HOME/.colorit.d/colors)
+
+changequote([[, ]])
+changequote([[``]], [['']])
+
+# color by permission
+define(color_by_permission, ``
+mark "(^$1.*[0-9][0-9]:?[0-9][0-9][[:space:]]+)([^[:space:]]+)" $2 col_normal
+'')
+
+# d---------
+color_by_permission(d........., fg_white)
+
+# s---------
+color_by_permission(s........., fg_purple)
+
+# l--------- i.e. symbolic link
+color_by_permission(l........., fg_green)
+
+# [bc]---------
+color_by_permission(b........., fg_red)



Home | Main Index | Thread Index | Old Index