Frustrant

Vols un preprocessador pel less que et parsegi els fitxers en perl, python i shell; sino, sempre acabes obrint-los amb el vi només per veure’ls en colors.

Et lies la manta al cap, li fas una ullada a enscript, determines el tipus d’script amb file, aprens a fer un hash en bash i quan gairebé ho tens… descobreixes com fer-ho amb una línia de codi.

# .lessfilter
#
#
# Jordi Funollet <jordi.f@ati.es>  Wed, 06 Feb 2008 22:05:11 +0100

( highlight -A "$1" && exit ) || exit 1

# Consider adding this to your etc/highlight/filetypes.conf
#
#   $shebang(sh)=^#!.*(bash|t?csh|[akz]?sh)$
#   $shebang(pl)=^#!.*perl$
#   $shebang(py)=^#!.*python$
#
# So it will match scripts with a '#!/usr/bin/env ...'

Que frustrant és adonar-te de que algú ja ha resolt tots els problemes fàcils.

Actualització: al moment d’escriure això, la versió de ‘highlight’ a la Debian Stable (Etch) té un bug com una casa de pagès. El workaround més directe és instal·lar el paquet de Lenny.

This entry was posted in codi-lliure and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>