From b7afd023a8e5ff86f751196984ba87dcb9d451cd Mon Sep 17 00:00:00 2001 From: Jacob Pipkin Date: Tue, 8 May 2012 00:44:49 -0500 Subject: initial repo add --- sbofind | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 sbofind (limited to 'sbofind') diff --git a/sbofind b/sbofind new file mode 100755 index 0000000..458689c --- /dev/null +++ b/sbofind @@ -0,0 +1,85 @@ +#!/usr/bin/env perl +# +# sbofind +# script to locate something in a local SlackBuilds tree. +# +# author: Jacob Pipkin +# date: Boomtime, the 39th day of Discord in the YOLD 3178 +# license: WTFPL + +use SBO::Lib; +use File::Basename; +use Getopt::Std; +use Text::Tabulate; +use strict; +use warnings FATAL => 'all'; + +my %config = %SBO::Lib::config; +my $self = basename($0); + +sub show_usage { + print <) { + unless ($found eq 'TRUE') { + if ($line =~ $regex) { + $found = 'TRUE'; + my @split = split(' ',$line); + chomp($name = $split[2]); + next FIRST; + } + } else { + if ($line =~ /LOCATION/) { + $found = 'FALSE'; + my @split = split(' ',$line); + chomp(my $location = $split[2]); + $location =~ s#^\.##; + my %hash = ($name => $config{SBO_HOME} . $location); + push(@findings,\%hash); + } + } +} + +if (exists $findings[0]) { + my @listing; + for my $hash (@findings) { + while (my ($key,$value) = each %{$hash}) { + push(@listing,"SBo: $key\n"); + push(@listing,"Path: $value\n\n"); + } + } + my $tab = new Text::Tabulate(); + $tab->configure(tab => '\s'); + my $output = $tab->format(@listing); + print "\n". $output; +} else { + print "Nothing found for search term: $search\n"; +} + +exit(0); -- cgit v1.2.3