aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib/SBO/Lib/Readme.pm
diff options
context:
space:
mode:
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib/Readme.pm')
-rw-r--r--SBO-Lib/lib/SBO/Lib/Readme.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/SBO-Lib/lib/SBO/Lib/Readme.pm b/SBO-Lib/lib/SBO/Lib/Readme.pm
index b29558b..d365a8a 100644
--- a/SBO-Lib/lib/SBO/Lib/Readme.pm
+++ b/SBO-Lib/lib/SBO/Lib/Readme.pm
@@ -13,6 +13,7 @@ use Exporter 'import';
our @EXPORT_OK = qw{
ask_opts
+ ask_other_readmes
ask_user_group
get_opts
get_readme_contents
@@ -77,6 +78,31 @@ sub ask_opts {
return();
}
+=head2 ask_other_readmes
+
+ ask_other_readmes($sbo, $location);
+
+C<ask_other_readmes()> checks if there are other readmes for the C<$sbo> in
+C<$location>, and if so, asks the user if they should be displayed, and then
+displays them if the user didn't decline.
+
+=cut
+
+sub ask_other_readmes {
+ my ($sbo, $location) = @_;
+ my @readmes = sort grep { ! m!/README$! } glob "$location/README*";
+
+ return unless @readmes;
+
+ return unless prompt("\nIt looks like $sbo has additional README files. Would you like to see those too?", default => 'yes');
+
+ for my $fn (@readmes) {
+ my ($display_fn) = $fn =~ m!/(README.*)$!;
+ say "\n$display_fn:";
+ say slurp $fn;
+ }
+}
+
=head2 ask_user_group
my $bool = ask_user_group($cmds, $readme);
@@ -183,6 +209,7 @@ sub user_prompt {
my $opts = 0;
$opts = ask_opts($sbo, $readme) if get_opts($readme);
print "\n". $readme unless $opts;
+ ask_other_readmes($sbo, $location);
# we have to return something substantial if the user says no so that we
# can check the value of $cmds on the calling side. we should be able to
# assume that 'N' will never be a valid command to run.