From 7c66d6959db746e36c397d50f16d34660f13fcb8 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Fri, 22 Jan 2016 12:49:43 +0000 Subject: [PATCH] Use nice colors for coloring files when LS_COLORS is not set. --- LS_COLORS | 739 +++++++++++++++++++++++++++++++++++++++++++++++++++ LS_COLORS.sh | 2 + TODO | 2 +- tools.py | 11 +- 4 files changed, 752 insertions(+), 2 deletions(-) create mode 100644 LS_COLORS create mode 100755 LS_COLORS.sh diff --git a/LS_COLORS b/LS_COLORS new file mode 100644 index 0000000..94409ec --- /dev/null +++ b/LS_COLORS @@ -0,0 +1,739 @@ +# LS_COLORS +# Maintainers: Magnus Woldrich , +# Ryan Delaney OpenGPG: 0D98863B4E1D07B6 +# URL: https://github.com/trapd00r/LS_COLORS +# Version: 0.254 +# Updated: Sun Jun 1 14:36:30 PDT 2014 +# +# This is a collection of extension:color mappings, suitable to use as your +# LS_COLORS environment variable. Most of them use the extended color map, +# described in the ECMA-48 document; in other words, you'll need a terminal +# with capabilities of displaying 256 colors. +# +# As of this writing, around 300 different filetypes/extensions is supported. +# That's indeed a lot of extensions, but there's a lot more! Therefore I need +# your help. +# +# Fork this project on github, add the extensions you are missing, and send me +# a pull request. +# +# For files that usually ends up next to each other, like html, css and js, +# try to pick colors that fit nicely together. Filetypes with multiple +# possible extensions, like htm and html, should have the same color. + +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the Perl Artistic License for more details. +# +# This program is free software: you can redistribute it and/or modify it under +# the terms of the Perl Artistic License as published by the Perl Foundation, +# either version 1.0 of the License, or (at your option) any later version. +# +# You should have received a copy of the Perl Artistic License along +# with this program. If not, see . + +# core {{{1 +BLK 38;5;68 +CAPABILITY 38;5;17 +CHR 38;5;113;1 +DIR 38;5;30 +DOOR 38;5;127 +EXEC 38;5;208;1 +FIFO 38;5;126 +FILE 38;5;253 +LINK target +MULTIHARDLINK 38;5;222;1 +# "NORMAL don't reset the bold attribute - +# https://github.com/trapd00r/LS_COLORS/issues/11 +#NORMAL 38;5;254 +ORPHAN 48;5;196;38;5;232;1 +OTHER_WRITABLE 38;5;220;1 +SETGID 48;5;3;38;5;0 +SETUID 38;5;220;1;3;100;1 +SOCK 38;5;197 +STICKY 38;5;86;48;5;234 +STICKY_OTHER_WRITABLE 48;5;235;38;5;139;3 + +*LS_COLORS 48;5;89;38;5;197;1;3;4;7 # :-) +# }}} +# documents {{{1 +*README 38;5;220;1 +*LICENSE 38;5;220;1 +*COPYING 38;5;220;1 +*INSTALL 38;5;220;1 +*COPYRIGHT 38;5;220;1 +*AUTHORS 38;5;220;1 +*HISTORY 38;5;220;1 +*CONTRIBUTORS 38;5;220;1 +*PATENTS 38;5;220;1 +*VERSION 38;5;220;1 +*NOTICE 38;5;220;1 +*CHANGES 38;5;220;1 +.log 38;5;190 +# plain-text {{{2 +.txt 38;5;253 +# markup {{{2 +.etx 38;5;184 +.info 38;5;184 +.markdown 38;5;184 +.md 38;5;184 +.mkd 38;5;184 +.nfo 38;5;184 +.pod 38;5;184 +.tex 38;5;184 +.textile 38;5;184 +# key-value, non-relational data {{{2 +.json 38;5;178 +.msg 38;5;178 +.pgn 38;5;178 +.rss 38;5;178 +.xml 38;5;178 +.yml 38;5;178 +# }}} +# binary {{{2 +.cbr 38;5;141 +.cbz 38;5;141 +.chm 38;5;141 +.djvu 38;5;141 +.pdf 38;5;141 +.PDF 38;5;141 +# words {{{3 +.docm 38;5;111;4 +.doc 38;5;111 +.docx 38;5;111 +.eps 38;5;111 +.ps 38;5;111 +.odb 38;5;111 +.odt 38;5;111 +# presentation {{{3 +.odp 38;5;166 +.pps 38;5;166 +.ppt 38;5;166 +# spreadsheet {{{3 +.csv 38;5;78 +# Open document spreadsheet +.ods 38;5;112 +.xla 38;5;76 +# Excel spreadsheet +.xls 38;5;112 +.xlsx 38;5;112 +# Excel spreadsheet with macros +.xlsxm 38;5;112;4 +# Excel module +.xltm 38;5;73;4 +.xltx 38;5;73 +# }}} +# }}} +# configs {{{2 +*cfg 1 +*conf 1 +*rc 1 +.ini 1 +# vim +.viminfo 1 +# cisco VPN client configuration +.pcf 1 +# adobe photoshop proof settings file +.psf 1 +# }}} +# }}} +# code {{{1 +# version control {{{2 +.git 38;5;197 +.gitignore 38;5;240 +.gitattributes 38;5;240 +.gitmodules 38;5;240 + +# shell {{{2 +.awk 38;5;172 +.bash 38;5;172 +.bat 38;5;172 +.BAT 38;5;172 +.sed 38;5;172 +.sh 38;5;172 +.zsh 38;5;172 +.vim 38;5;172 + +# interpreted {{{2 +.ahk 38;5;41 +# python +.py 38;5;41 +# perl +.pl 38;5;41 +# sql +.msql 38;5;222 +.mysql 38;5;222 +.pgsql 38;5;222 +.sql 38;5;222 +# Tool Command Language +.tcl 38;5;64;1 + +# compiled {{{2 +# +# assembly language +.asm 38;5;81 +# LISP +.cl 38;5;81 +.lisp 38;5;81 +# lua +.lua 38;5;81 +# Moonscript +.moon 38;5;81 +# C +.c 38;5;81 +.C 38;5;81 +.h 38;5;110 +.H 38;5;110 +.tcc 38;5;110 +# C++ +.c++ 38;5;81 +.h++ 38;5;110 +.hpp 38;5;110 +.hxx 38;5;110 +.ii 38;5;110 +# method file for Objective C +.M 38;5;110 +.m 38;5;110 +# Csharp +.cc 38;5;81 +.cs 38;5;81 +.cp 38;5;81 +.cpp 38;5;81 +.cxx 38;5;81 +# Crystal +.cr 38;5;81 +# Google golang +.go 38;5;81 +# fortran +.f 38;5;81 +.for 38;5;81 +.ftn 38;5;81 +# pascal +.s 38;5;110 +.S 38;5;110 +# Rust +.rs 38;5;81 +# ? +.sx 38;5;81 +# interface file in GHC - https://github.com/trapd00r/LS_COLORS/pull/9 +.hi 38;5;110 +# haskell +.hs 38;5;81 + +# binaries {{{2 +# compiled apps for interpreted languages +.PL 38;5;160 +.pyc 38;5;240 +# }}} +# html {{{2 +.css 38;5;125;1 +.less 38;5;125;1 +.sass 38;5;125;1 +.scss 38;5;125;1 +.htm 38;5;125;1 +.html 38;5;125;1 +.jhtm 38;5;125;1 +.mht 38;5;125;1 +.eml 38;5;125;1 +.mustache 38;5;125;1 +# }}} +# java {{{2 +.coffee 38;5;074;1 +.java 38;5;074;1 +.js 38;5;074;1 +.jsm 38;5;074;1 +.jsm 38;5;074;1 +.jsp 38;5;074;1 +# }}} +# php {{{2 +.php 38;5;81 +# CakePHP view scripts and helpers +.ctp 38;5;81 +# Twig template engine +.twig 38;5;81 +# }}} +# vb/a {{{2 +.vb 38;5;81 +.vba 38;5;81 +.vbs 38;5;81 +# 2}}} +# Build stuff {{{2 +*Makefile 38;5;155 +*MANIFEST 38;5;243 +*pm_to_blib 38;5;240 +# automake +.am 38;5;242 +.in 38;5;242 +.hin 38;5;242 +.scan 38;5;242 +.m4 38;5;242 +.old 38;5;242 +.out 38;5;242 +.SKIP 38;5;244 +# }}} +# patch files {{{2 +.diff 48;5;197;38;5;232 +.patch 48;5;197;38;5;232;1 +#}}} +# graphics {{{1 +.bmp 38;5;97 +.tiff 38;5;97 +.TIFF 38;5;97 +.cdr 38;5;97 +.gif 38;5;97 +.ico 38;5;97 +.jpeg 38;5;97 +.JPG 38;5;97 +.jpg 38;5;97 +.nth 38;5;97 +.png 38;5;97 +.svg 38;5;97 +.xpm 38;5;97 +# }}} +# video {{{1 +.avi 38;5;114 +.divx 38;5;114 +.IFO 38;5;114 +.m2v 38;5;114 +.m4v 38;5;114 +.mkv 38;5;114 +.MOV 38;5;114 +.mov 38;5;114 +.mp4 38;5;114 +.mpeg 38;5;114 +.mpg 38;5;114 +.ogm 38;5;114 +.rmvb 38;5;114 +.sample 38;5;114 +.wmv 38;5;114 + # mobile/streaming {{{2 +.3g2 38;5;115 +.3gp 38;5;115 +.gp3 38;5;115 +.webm 38;5;115 +.gp4 38;5;115 +.asf 38;5;115 +.flv 38;5;115 +.ts 38;5;115 +.ogv 38;5;115 +.f4v 38;5;115 + # }}} + # lossless {{{2 +.VOB 38;5;115;1 +.vob 38;5;115;1 +# }}} +# audio {{{1 +.3ga 38;5;137;1 +.S3M 38;5;137;1 +.aac 38;5;137;1 +.dat 38;5;137;1 +.dts 38;5;137;1 +.fcm 38;5;137;1 +.m4a 38;5;137;1 +.mid 38;5;137;1 +.midi 38;5;137;1 +.mod 38;5;137;1 +.mp3 38;5;137;1 +.oga 38;5;137;1 +.ogg 38;5;137;1 +.s3m 38;5;137;1 +.sid 38;5;137;1 +# lossless +.ape 38;5;136;1 +.flac 38;5;136;1 +.alac 38;5;136;1 +.wav 38;5;136;1 +.wv 38;5;136;1 +.wvc 38;5;136;1 + +# }}} +# fonts {{{1 +.afm 38;5;66 +.pfb 38;5;66 +.pfm 38;5;66 +.ttf 38;5;66 +.otf 38;5;66 +# postscript fonts +.PFA 38;5;66 +.pfa 38;5;66 +# }}} +# archives {{{1 +.7z 38;5;40 +.a 38;5;40 +.arj 38;5;40 +.bz2 38;5;40 +.gz 38;5;40 +.rar 38;5;40 +.tar 38;5;40 +.tgz 38;5;40 +.xz 38;5;40 +.zip 38;5;40 + # packaged apps {{{2 +.apk 38;5;215 +.deb 38;5;215 +.jad 38;5;215 +.jar 38;5;215 +.cab 38;5;215 +.pak 38;5;215 +.pk3 38;5;215 +.vdf 38;5;215 +.vpk 38;5;215 +.bsp 38;5;215 +.dmg 38;5;215 + # }}} + # segments {{{2 +.r00 38;5;239 +.r01 38;5;239 +.r02 38;5;239 +.r03 38;5;239 +.r04 38;5;239 +.r05 38;5;239 +.r06 38;5;239 +.r07 38;5;239 +.r08 38;5;239 +.r09 38;5;239 +.r10 38;5;239 +.r100 38;5;239 +.r101 38;5;239 +.r102 38;5;239 +.r103 38;5;239 +.r104 38;5;239 +.r105 38;5;239 +.r106 38;5;239 +.r107 38;5;239 +.r108 38;5;239 +.r109 38;5;239 +.r11 38;5;239 +.r110 38;5;239 +.r111 38;5;239 +.r112 38;5;239 +.r113 38;5;239 +.r114 38;5;239 +.r115 38;5;239 +.r116 38;5;239 +.r12 38;5;239 +.r13 38;5;239 +.r14 38;5;239 +.r15 38;5;239 +.r16 38;5;239 +.r17 38;5;239 +.r18 38;5;239 +.r19 38;5;239 +.r20 38;5;239 +.r21 38;5;239 +.r22 38;5;239 +.r25 38;5;239 +.r26 38;5;239 +.r27 38;5;239 +.r28 38;5;239 +.r29 38;5;239 +.r30 38;5;239 +.r31 38;5;239 +.r32 38;5;239 +.r33 38;5;239 +.r34 38;5;239 +.r35 38;5;239 +.r36 38;5;239 +.r37 38;5;239 +.r38 38;5;239 +.r39 38;5;239 +.r40 38;5;239 +.r41 38;5;239 +.r42 38;5;239 +.r43 38;5;239 +.r44 38;5;239 +.r45 38;5;239 +.r46 38;5;239 +.r47 38;5;239 +.r48 38;5;239 +.r49 38;5;239 +.r50 38;5;239 +.r51 38;5;239 +.r52 38;5;239 +.r53 38;5;239 +.r54 38;5;239 +.r55 38;5;239 +.r56 38;5;239 +.r57 38;5;239 +.r58 38;5;239 +.r59 38;5;239 +.r60 38;5;239 +.r61 38;5;239 +.r62 38;5;239 +.r63 38;5;239 +.r64 38;5;239 +.r65 38;5;239 +.r66 38;5;239 +.r67 38;5;239 +.r68 38;5;239 +.r69 38;5;239 +.r69 38;5;239 +.r70 38;5;239 +.r71 38;5;239 +.r72 38;5;239 +.r73 38;5;239 +.r74 38;5;239 +.r75 38;5;239 +.r76 38;5;239 +.r77 38;5;239 +.r78 38;5;239 +.r79 38;5;239 +.r80 38;5;239 +.r81 38;5;239 +.r82 38;5;239 +.r83 38;5;239 +.r84 38;5;239 +.r85 38;5;239 +.r86 38;5;239 +.r87 38;5;239 +.r88 38;5;239 +.r89 38;5;239 +.r90 38;5;239 +.r91 38;5;239 +.r92 38;5;239 +.r93 38;5;239 +.r94 38;5;239 +.r95 38;5;239 +.r96 38;5;239 +.r97 38;5;239 +.r98 38;5;239 +.r99 38;5;239 +# partial files +.part 38;5;239 + # }}} +# partition images {{{2 +.iso 38;5;124 +.bin 38;5;124 +.nrg 38;5;124 +.qcow 38;5;124 +.sparseimage 38;5;124 +# }}} +# databases {{{2 +.accdb 38;5;60 +.accde 38;5;60 +.accdr 38;5;60 +.accdt 38;5;60 +.db 38;5;60 +.localstorage 38;5;60 +.sqlite 38;5;60 +.typelib 38;5;60 +# }}} +# tempfiles {{{1 +# undo files +.pacnew 38;5;33 +.un~ 38;5;241 +.orig 38;5;241 +# backups +.BUP 38;5;241 +.bak 38;5;241 +.o 38;5;241 # *nix Object file (shared libraries, core dumps etc) +.rlib 38;5;241 # Static rust library +# temporary files +.swp 38;5;244 +.swo 38;5;244 +.tmp 38;5;244 +.sassc 38;5;244 +# state files +.pid 38;5;248 +.state 38;5;248 +*lockfile 38;5;248 +# error logs +.err 38;5;160;1 +.error 38;5;160;1 +.stderr 38;5;160;1 +# state dumps +.dump 38;5;241 +.stackdump 38;5;241 +.zcompdump 38;5;241 +.zwc 38;5;241 +# tcpdump, network traffic capture +.pcap 38;5;29 +.cap 38;5;29 +.dmp 38;5;29 +# }}} +# hosts {{{1 +# /etc/hosts.{deny,allow} +.allow 38;5;112 +.deny 38;5;196 +# }}} +# systemd {{{1 +# http://www.freedesktop.org/software/systemd/man/systemd.unit.html +.service 38;5;45 +*@.service 38;5;45 +.socket 38;5;45 +.swap 38;5;45 +.device 38;5;45 +.mount 38;5;45 +.automount 38;5;45 +.target 38;5;45 +.path 38;5;45 +.timer 38;5;45 +.snapshot 38;5;45 +# }}} +# metadata {{{1 +.application 38;5;116 +.cue 38;5;116 +.description 38;5;116 +.directory 38;5;116 +.m3u 38;5;116 +.m3u8 38;5;116 +.md5 38;5;116 +.properties 38;5;116 +.sfv 38;5;116 +.srt 38;5;116 +.theme 38;5;116 +.torrent 38;5;116 +.urlview 38;5;116 +# }}} +# encrypted data {{{1 +.asc 38;5;192;3 +.enc 38;5;192;3 +.gpg 38;5;192;3 +.signature 38;5;192;3 +.sig 38;5;192;3 +.p12 38;5;192;3 +.pem 38;5;192;3 +.pgp 38;5;192;3 +.asc 38;5;192;3 +.enc 38;5;192;3 +.sig 38;5;192;3 +.signature 38;5;192;3 +# 1}}} +# emulators {{{1 +.32x 38;5;213 +.cdi 38;5;213 +.fm2 38;5;213 +.rom 38;5;213 +.sav 38;5;213 +.st 38;5;213 + # atari +.a00 38;5;213 +.a52 38;5;213 +.A64 38;5;213 +.a64 38;5;213 +.a78 38;5;213 +.adf 38;5;213 +.atr 38;5;213 + # nintendo +.gb 38;5;213 +.gba 38;5;213 +.gbc 38;5;213 +.gel 38;5;213 +.gg 38;5;213 +.ggl 38;5;213 +.ipk 38;5;213 # Nintendo (DS Packed Images) +.j64 38;5;213 +.nds 38;5;213 +.nes 38;5;213 + # Sega +.sms 38;5;213 +# }}} +# unsorted {{{1 +# +# Portable Object Translation for GNU Gettext +.pot 38;5;7 +# CAD files for printed circuit boards +.pcb 38;5;7 +# groff (rendering app for texinfo) +.mm 38;5;7 +# perldoc +.pod 38;5;7 +# GIMP brush +.gbr 38;5;7 +# Linux Shell Executable Binary +.pl 38;5;7 +# printer spool file +.spl 38;5;7 +# GIMP project file +.scm 38;5;7 +# Nokia Symbian OS files +.sis 38;5;7 + +.1p 38;5;7 +.3p 38;5;7 +.cnc 38;5;7 +.def 38;5;7 +.ex 38;5;7 +.example 38;5;7 +.feature 38;5;7 +.ger 38;5;7 +.map 38;5;7 +.mf 38;5;7 +.mfasl 38;5;7 +.mi 38;5;7 +.mtx 38;5;7 +.pc 38;5;7 +.pi 38;5;7 +.plt 38;5;7 +.pm 38;5;7 +.rb 38;5;7 +.rdf 38;5;7 +.rst 38;5;7 +.ru 38;5;7 +.sch 38;5;7 +.sty 38;5;7 +.sug 38;5;7 +.t 38;5;7 +.tdy 38;5;7 +.tfm 38;5;7 +.tfnt 38;5;7 +.tg 38;5;7 +.vcard 38;5;7 +.vcf 38;5;7 +.xln 38;5;7 +# }}} +# termcap {{{1 +TERM ansi +TERM color-xterm +TERM con132x25 +TERM con132x30 +TERM con132x43 +TERM con132x60 +TERM con80x25 +TERM con80x28 +TERM con80x30 +TERM con80x43 +TERM con80x50 +TERM con80x60 +TERM cons25 +TERM console +TERM cygwin +TERM dtterm +TERM Eterm +TERM eterm-color +TERM gnome +TERM gnome-256color +TERM jfbterm +TERM konsole +TERM kterm +TERM linux +TERM linux-c +TERM mach-color +TERM mlterm +TERM putty +TERM rxvt +TERM rxvt-256color +TERM rxvt-cygwin +TERM rxvt-cygwin-native +TERM rxvt-unicode +TERM rxvt-unicode-256color +TERM rxvt-unicode256 +TERM screen +TERM screen-256color +TERM screen-256color-bce +TERM screen-bce +TERM screen-w +TERM screen.linux +TERM screen.rxvt +TERM terminator +TERM vt100 +TERM xterm +TERM xterm-16color +TERM xterm-256color +TERM xterm-88color +TERM xterm-color +TERM xterm-debian +# }}} + + +# vim: ft=dircolors:fdm=marker:et:sw=2: diff --git a/LS_COLORS.sh b/LS_COLORS.sh new file mode 100755 index 0000000..2aa5472 --- /dev/null +++ b/LS_COLORS.sh @@ -0,0 +1,2 @@ +LS_COLORS='bd=38;5;68:ca=38;5;17:cd=38;5;113;1:di=38;5;30:do=38;5;127:ex=38;5;166;1:pi=38;5;126:fi=38;5;253:ln=target:mh=38;5;220;1:no=38;5;254:or=48;5;196;38;5;232;1:ow=38;5;33;1:sg=38;5;137;1:su=38;5;137:so=38;5;197:st=48;5;235;38;5;118;1:tw=48;5;235;38;5;139;1:*.BAT=38;5;108:*.PL=38;5;160:*.asm=38;5;240;1:*.awk=38;5;148;1:*.bash=38;5;173:*.bat=38;5;108:*.c=38;5;110:*.cfg=1:*.coffee=38;5;94;1:*.conf=1:*.cpp=38;5;24;1:*.cs=38;5;74;1:*.css=38;5;91:*.csv=38;5;78:*.diff=48;5;197;38;5;232:*.enc=38;5;192;3:*.eps=38;5;192:*.etx=38;5;172:*.ex=38;5;148;1:*.example=38;5;225;1:*.git=38;5;197:*.gitignore=38;5;240:*.go=38;5;36;1:*.h=38;5;81:*.hs=38;5;159:*.htm=38;5;125;1:*.html=38;5;125;1:*.info=38;5;101:*.ini=38;5;122:*.java=38;5;142;1:*.jhtm=38;5;125;1:*.js=38;5;42:*.jsm=38;5;42:*.jsm=38;5;42:*.json=38;5;199:*.jsp=38;5;45:*.lisp=38;5;204;1:*.log=38;5;190:*.lua=38;5;34;1:*.map=38;5;58;3:*.markdown=38;5;184:*.md=38;5;184:*.mf=38;5;220;3:*.mfasl=38;5;73:*.mi=38;5;124:*.mkd=38;5;184:*.mtx=38;5;36;3:*.nfo=38;5;220:*.pacnew=38;5;33:*.patch=48;5;197;38;5;232;1:*.pc=38;5;100:*.pfa=38;5;43:*.php=38;5;93:*.pid=38;5;160:*.pl=38;5;214:*.pm=38;5;197;1:*.pod=38;5;172;1:*.py=38;5;41:*.rb=38;5;192:*.rdf=38;5;144:*.ru=38;5;142:*.sed=38;5;130;1:*.sfv=38;5;197:*.sh=38;5;113:*.signature=38;5;206:*.sql=38;5;222:*.srt=38;5;116:*.sty=38;5;58:*.sug=38;5;44:*.t=38;5;28;1:*.tcl=38;5;64;1:*.tdy=38;5;214:*.tex=38;5;172:*.textile=38;5;106:*.tfm=38;5;64:*.tfnt=38;5;140:*.theme=38;5;109:*.txt=38;5;192:*.urlview=38;5;85:*.vim=1:*.viminfo=38;5;240;1:*.xml=38;5;199:*.yml=38;5;208:*.zsh=38;5;173:*.1=38;5;196;1:*.1p=38;5;160:*.3p=38;5;160:*.am=38;5;242:*.in=38;5;242:*.old=38;5;242:*.out=38;5;46;1:*.bmp=38;5;62:*.cdr=38;5;59:*.gif=38;5;72:*.ico=38;5;73:*.jpeg=38;5;66:*.jpg=38;5;66:*.JPG=38;5;66:*.png=38;5;68;1:*.svg=38;5;24;1:*.xpm=38;5;36:*.32x=38;5;137:*.A64=38;5;82:*.a00=38;5;11:*.a52=38;5;112:*.a64=38;5;82:*.a78=38;5;112:*.adf=38;5;35:*.atr=38;5;213:*.cdi=38;5;124:*.fm2=38;5;35:*.gb=38;5;203:*.gba=38;5;205:*.gbc=38;5;204:*.gel=38;5;83:*.gg=38;5;138:*.ggl=38;5;83:*.j64=38;5;102:*.nds=38;5;193:*.nes=38;5;160:*.rom=38;5;59;1:*.sav=38;5;220:*.sms=38;5;33:*.st=38;5;208;1:*.iso=38;5;124:*.nrg=38;5;124:*.qcow=38;5;141:*.MOV=38;5;42:*.avi=38;5;114:*.flv=38;5;131:*.mkv=38;5;202:*.mov=38;5;42:*.mp4=38;5;124:*.mpg=38;5;38:*.mpeg=38;5;38:*.ogm=38;5;97:*.ogv=38;5;94:*.rmvb=38;5;112:*.sample=38;5;130;1:*.ts=38;5;39:*.webm=38;5;132:*.wmv=38;5;113:*.S3M=38;5;71;1:*.cue=38;5;112:*.dat=38;5;165:*.fcm=38;5;41:*.flac=38;5;166;1:*.m3u=38;5;172:*.m4=38;5;196;3:*.m4a=38;5;137;1:*.mod=38;5;72:*.mp3=38;5;191:*.oga=38;5;95:*.ogg=38;5;96:*.s3m=38;5;71;1:*.sid=38;5;69;1:*.spl=38;5;173:*.wv=38;5;149:*.wvc=38;5;149:*.afm=38;5;58:*.pfb=38;5;58:*.pfm=38;5;58:*.ttf=48;5;1:*.pcf=38;5;65:*.psf=38;5;64:*.bak=38;5;41;1:*.bin=38;5;249:*.swo=38;5;236:*.swp=38;5;241:*.tmp=38;5;244:*.un~=38;5;240:*.zcompdump=38;5;240:*.zwc=38;5;240:*.db=38;5;60:*.dump=38;5;119:*.sqlite=38;5;60:*.typelib=38;5;60:*.7z=38;5;40:*.a=38;5;46:*.arj=38;5;41:*.bz2=38;5;44:*.jad=38;5;50:*.jar=38;5;51:*.part=38;5;240;1:*.r00=38;5;235:*.r01=38;5;235:*.r02=38;5;235:*.r03=38;5;236:*.r04=38;5;237:*.r05=38;5;238:*.r06=38;5;239:*.r07=38;5;240:*.r08=38;5;241:*.r09=38;5;242:*.r10=38;5;243:*.r100=38;5;244:*.r101=38;5;240:*.r102=38;5;241:*.r103=38;5;242:*.r104=38;5;243:*.r105=38;5;244:*.r106=38;5;245:*.r107=38;5;246:*.r108=38;5;247:*.r109=38;5;248:*.r11=38;5;244:*.r110=38;5;249:*.r111=38;5;250:*.r112=38;5;251:*.r113=38;5;252:*.r114=38;5;253:*.r115=38;5;254:*.r116=38;5;255:*.r12=38;5;245:*.r13=38;5;246:*.r14=38;5;247:*.r15=38;5;248:*.r16=38;5;249:*.r17=38;5;250:*.r18=38;5;251:*.r19=38;5;252:*.r20=38;5;253:*.r21=38;5;254:*.r22=38;5;255:*.r25=38;5;255:*.r26=38;5;254:*.r27=38;5;253:*.r28=38;5;252:*.r29=38;5;251:*.r30=38;5;250:*.r31=38;5;249:*.r32=38;5;248:*.r33=38;5;247:*.r34=38;5;246:*.r35=38;5;245:*.r36=38;5;244:*.r37=38;5;243:*.r38=38;5;242:*.r39=38;5;241:*.r40=38;5;240:*.r41=38;5;239:*.r42=38;5;238:*.r43=38;5;237:*.r44=38;5;236:*.r45=38;5;235:*.r46=38;5;235:*.r47=38;5;235:*.r48=38;5;235:*.r49=38;5;235:*.r50=38;5;236:*.r51=38;5;237:*.r52=38;5;238:*.r53=38;5;239:*.r54=38;5;240:*.r55=38;5;241:*.r56=38;5;242:*.r57=38;5;243:*.r58=38;5;244:*.r59=38;5;245:*.r60=38;5;246:*.r61=38;5;247:*.r62=38;5;248:*.r63=38;5;249:*.r64=38;5;250:*.r65=38;5;251:*.r66=38;5;252:*.r67=38;5;253:*.r68=38;5;254:*.r69=38;5;255:*.r69=38;5;255:*.r70=38;5;254:*.r71=38;5;253:*.r72=38;5;252:*.r73=38;5;251:*.r74=38;5;250:*.r75=38;5;249:*.r76=38;5;248:*.r77=38;5;247:*.r78=38;5;246:*.r79=38;5;245:*.r80=38;5;244:*.r81=38;5;243:*.r82=38;5;242:*.r83=38;5;241:*.r84=38;5;240:*.r85=38;5;239:*.r86=38;5;238:*.r87=38;5;237:*.r88=38;5;236:*.r89=38;5;235:*.r90=38;5;235:*.r91=38;5;235:*.r92=38;5;236:*.r93=38;5;237:*.r94=38;5;238:*.r95=38;5;239:*.r96=38;5;240:*.r97=38;5;241:*.r98=38;5;242:*.r99=38;5;243:*.rar=38;5;106;1:*.tar=38;5;118:*.tar.gz=38;5;34:*.tgz=38;5;35;1:*.xz=38;5;118:*.zip=38;5;41:*.pdf=38;5;203:*.djvu=38;5;141:*.cbr=38;5;140:*.cbz=38;5;140:*.chm=38;5;144:*.odt=38;5;111:*.ods=38;5;112:*.odp=38;5;166:*.odb=38;5;161:*.SKIP=38;5;244:*.def=38;5;136:*.directory=38;5;83:*.err=38;5;160;1:*.error=38;5;160;1:*.pi=38;5;126:*.properties=38;5;197;1:*.torrent=38;5;58:'; +export LS_COLORS diff --git a/TODO b/TODO index 01fab2c..f945a42 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,6 @@ Todo - Cache tools._python_version. - Determine if perl files are perl5 or perl6. - Use perldoc on pod files. -- Add rich LSCOLORS if the environment variable is not set. - Add bandit tool for python. @@ -155,6 +154,7 @@ Done - Colourise mccabe. - Have a sandbox for unsafe (or all) tools. - Simplify coloring of mccabe. Just color functions with complexity greater than 10. +- Add rich LSCOLORS if the environment variable is not set. A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps A B C D E F G H diff --git a/tools.py b/tools.py index 502c0bc..159b57d 100644 --- a/tools.py +++ b/tools.py @@ -69,7 +69,16 @@ _STATUS_TO_TERMSTR_SIMPLE[Status.error] = termstr.TermStr( _STATUS_TO_TERMSTR_SIMPLE[Status.empty] = "." -LS_COLOR_CODES = lscolors.get_color_codes(os.environ) +def get_ls_color_codes(): + if "LS_COLORS" not in os.environ: + script = os.path.join(os.path.dirname(__file__), "LS_COLORS.sh") + with open(script) as file_: + codes = file_.readline().strip()[len("LS_COLORS='"):-len("';")] + os.environ["LS_COLORS"] = codes + return lscolors.get_color_codes(os.environ) + + +LS_COLOR_CODES = get_ls_color_codes() def fix_input(input_):