summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-04-19 22:21:26 +0000
committerMike Frysinger <vapier@gentoo.org>2005-04-19 22:21:26 +0000
commitf931069cb535181abd5c5bf6f6807d2cb948b11d (patch)
tree51e3ca709dab074ebf5da0d2f269c2b97ad76f14 /app-admin/durep/files
parentold (diff)
downloadgentoo-2-f931069cb535181abd5c5bf6f6807d2cb948b11d.tar.gz
gentoo-2-f931069cb535181abd5c5bf6f6807d2cb948b11d.tar.bz2
gentoo-2-f931069cb535181abd5c5bf6f6807d2cb948b11d.zip
Add support for colored output by Daniele Antonini #88706.
(Portage version: 2.0.51.19)
Diffstat (limited to 'app-admin/durep/files')
-rw-r--r--app-admin/durep/files/digest-durep-0.9-r11
-rw-r--r--app-admin/durep/files/durep-0.9-color-output.patch157
2 files changed, 158 insertions, 0 deletions
diff --git a/app-admin/durep/files/digest-durep-0.9-r1 b/app-admin/durep/files/digest-durep-0.9-r1
new file mode 100644
index 000000000000..42331a33b325
--- /dev/null
+++ b/app-admin/durep/files/digest-durep-0.9-r1
@@ -0,0 +1 @@
+MD5 fb6d09d48b02b150501f7e769087696f durep-0.9.tar.gz 13713
diff --git a/app-admin/durep/files/durep-0.9-color-output.patch b/app-admin/durep/files/durep-0.9-color-output.patch
new file mode 100644
index 000000000000..9e491f500581
--- /dev/null
+++ b/app-admin/durep/files/durep-0.9-color-output.patch
@@ -0,0 +1,157 @@
+--- durep 2005-04-11 14:07:48.000000000 +0200
++++ durep_new 2005-04-11 14:08:27.000000000 +0200
+@@ -14,6 +14,8 @@
+ #############################################################################
+
+ use Getopt::Long;
++use Switch;
++use Term::ANSIColor qw(:constants);
+ use File::Basename;
+ use MLDBM qw(DB_File Storable);
+ use Fcntl;
+@@ -27,6 +29,7 @@
+ our ($root_node, $filesystem_id, @stats);
+ our ($opt_help, $opt_version, $opt_textdepth, $opt_hidesize, $opt_showdate, $opt_nosort, $opt_quiet);
+ our ($opt_savefile, $opt_loadfile, $opt_desc, $opt_collate);
++our ($opt_nocolor);
+ our ($opt_files, $opt_onefilesystem, $opt_collapsepath, $opt_excludepath, $opt_coalescefiles);
+ our ($root_dir, $file_count, $dir_count, $next_id);
+ our ($TYPE_FILE, $TYPE_DIR, $TYPE_EMPTY, $TYPE_COALESCED, $TYPE_COLLAPSED);
+@@ -56,6 +59,8 @@
+ "d|desc=s" => \$opt_desc,
+ "c|collate=s" => \$opt_collate,
+
++ "nc|nocolor" => \$opt_nocolor,
++
+ "f|files" => \$opt_files,
+ "x|one-file-system" => \$opt_onefilesystem,
+ "cp|collapse-path=s" => \$opt_collapsepath,
+@@ -331,13 +336,117 @@
+ printf(" [%s%s] ", "#" x $numofchars, " " x (30-$numofchars));
+ printf("%6.2f%% ", $percent);
+ printf("%s ", shortDate($entry->{MTIME})) if $opt_showdate;
+- printf("%s%s\n", $entry->{NAME}, $entry->{TYPE} & $TYPE_DIR ? "/" : "");
++
++ printColor( $entry ) unless ( $opt_nocolor );
++ printNoColor( $entry ) if ( $opt_nocolor );
+ if($entry->{TYPE} & $TYPE_DIR) {
+ printDir($entry, $indent+1) if(!defined $opt_textdepth || ($opt_textdepth > $indent+1));
+ }
+ }
+ }
+
++sub printColor {
++ my $entry = shift;
++
++ my @tmp = split /\./, $entry->{NAME};
++
++ if ( $entry->{TYPE} & $TYPE_DIR ) { print BLUE, BOLD, $entry->{NAME}."/\n", RESET }
++ else {
++ switch ($tmp[$#tmp]) {
++ #executable ( brigth gree)
++ case "cmd" { print BOLD, GREEN, $entry->{NAME}."\n", RESET }
++ case "exe" { print BOLD, GREEN, $entry->{NAME}."\n", RESET }
++ case "com" { print BOLD, GREEN, $entry->{NAME}."\n", RESET }
++ case "btm" { print BOLD, GREEN, $entry->{NAME}."\n", RESET }
++ case "bat" { print BOLD, GREEN, $entry->{NAME}."\n", RESET }
++ case "sh" { print BOLD, GREEN, $entry->{NAME}."\n", RESET }
++ case "csh" { print BOLD, GREEN, $entry->{NAME}."\n", RESET }
++
++ #archieves / compressed (brigth red)
++ case "tar" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "tgz" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "arj" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "taz" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "lzh" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "zip" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "z" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "Z" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "gz" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "bz2" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "tbz2" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "tz" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "deb" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "rpm" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "rar" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "ace" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "zoo" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "cpio" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "7z" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++ case "rz" { print BOLD, RED, $entry->{NAME}."\n", RESET }
++
++ #image formats
++ case "jpg" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "jpeg" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "gif" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "bmp" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "ppm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "tga" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "xbm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "xpm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "tif" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "tiff" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "png" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "mng" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "xcf" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "pcx" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "mpg" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "mpeg" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "m2v" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "avi" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "mkv" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "ogm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "mp4" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "mp4v" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "mov" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "qt" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "wmv" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "asf" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "rm" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "rmvb" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "flc" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "fli" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "gl" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++ case "dl" { print BOLD, MAGENTA, $entry->{NAME}."\n", RESET }
++
++ case "pdf" { print GREEN, $entry->{NAME}."\n", RESET }
++ case "ps" { print GREEN, $entry->{NAME}."\n", RESET }
++ case "txt" { print GREEN, $entry->{NAME}."\n", RESET }
++ case "patch" { print GREEN, $entry->{NAME}."\n", RESET }
++ case "diff" { print GREEN, $entry->{NAME}."\n", RESET }
++ case "log" { print GREEN, $entry->{NAME}."\n", RESET }
++ case "tex" { print GREEN, $entry->{NAME}."\n", RESET }
++ case "doc" { print GREEN, $entry->{NAME}."\n", RESET }
++
++ case "mp3" { print CYAN, $entry->{NAME}."\n", RESET }
++ case "wav" { print CYAN, $entry->{NAME}."\n", RESET }
++ case "mid" { print CYAN, $entry->{NAME}."\n", RESET }
++ case "midi" { print CYAN, $entry->{NAME}."\n", RESET }
++ case "au" { print CYAN, $entry->{NAME}."\n", RESET }
++ case "ogg" { print CYAN, $entry->{NAME}."\n", RESET }
++ case "flac" { print CYAN, $entry->{NAME}."\n", RESET }
++ case "aac" { print CYAN, $entry->{NAME}."\n", RESET }
++
++ else { print $entry->{NAME}."\n", RESET }
++ }
++ }
++}
++
++sub printNoColor {
++ my $entry = shift;
++
++ printf("%s%s\n", $entry->{NAME}, $entry->{TYPE} & $TYPE_DIR ? "/" : "");
++}
++
+ sub processSizeOption {
+ my ($size, $temp);
+
+@@ -437,6 +547,9 @@
+ -d, --desc=<description> give description of save file
+ -c, --collate=<dir> collate save files in dir for web report
+
++Color Option:
++ -nc, --nocolor no color output
++ By default durep color outpu
+ Inclusion Options:
+ -f, --files do not descend into subdirs, only report files
+ -x, --one-file-system do not traverse file systems