From 74ceb302d143950e02606329cda0fbca70a99985 Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Thu, 18 May 2017 17:01:51 +0200 Subject: sbofind: add version to result output - This closes #60. --- sbofind | 5 +++-- t/17-find.t | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sbofind b/sbofind index d9b6dbe..9869ee9 100755 --- a/sbofind +++ b/sbofind @@ -13,7 +13,7 @@ use 5.16.0; use strict; use warnings FATAL => 'all'; -use SBO::Lib qw/ slackbuilds_or_fetch slurp script_error open_read get_build_queue %config $slackbuilds_txt $repo_path show_version in indent /; +use SBO::Lib qw/ slackbuilds_or_fetch slurp script_error open_read get_build_queue %config $slackbuilds_txt $repo_path show_version in indent get_from_info /; use File::Basename; use Getopt::Long qw(:config bundling); @@ -159,8 +159,9 @@ if (exists $$findings[0]) { for my $hash (@$findings) { my $name = $hash->{name}; my $location = $hash->{location}; + my $version = get_from_info(LOCATION => $location, GET => 'VERSION')->[0]; my $sbo = "SBo: "; $sbo = "Local: " if $hash->{local}; - say "$sbo $name"; + say "$sbo $name $version"; say "Path: $location"; say "info: ". get_file_contents("$location/$name.info") if $show_info; say "README: ". get_file_contents("$location/README") if $show_readme; diff --git a/t/17-find.t b/t/17-find.t index 5ea3e74..2be2a56 100755 --- a/t/17-find.t +++ b/t/17-find.t @@ -16,14 +16,14 @@ make_slackbuilds_txt(); set_lo("$RealBin/LO"); # 1: basic sbofind testing -sbofind 'nonexistentslackbuild4', { expected => qr!Local:\s+nonexistentslackbuild4\nPath:\s+\Q$RealBin/LO/nonexistentslackbuild4! }; +sbofind 'nonexistentslackbuild4', { expected => qr!Local:\s+nonexistentslackbuild4 .*\nPath:\s+\Q$RealBin/LO/nonexistentslackbuild4! }; # 2: basic sbofind testing - nothing found sbofind 'nonexistentslackbuild3', { expected => "Nothing found for search term: nonexistentslackbuild3\n" }; # 3: find something using a tag replace_tags_txt("nonexistentslackbuild2: testingtag\n"); -sbofind 'testingtag', { expected => qr!Local:\s+nonexistentslackbuild2\nPath:\s+\Q$RealBin/LO/nonexistentslackbuild2! }; +sbofind 'testingtag', { expected => qr!Local:\s+nonexistentslackbuild2 .*\nPath:\s+\Q$RealBin/LO/nonexistentslackbuild2! }; # 4: show build queue sbofind '-q', 'nonexistentslackbuild2', { expected => qr/Queue:\s+nonexistentslackbuild3 nonexistentslackbuild2/ }; -- cgit v1.2.3