diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-12-14 09:10:33 +0200 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-12-14 09:10:33 +0200 |
commit | aa5396514bbcef8f1278e857f7da034611b126a0 (patch) | |
tree | 229faa0a1afbe2d3778af167ad0de1fd9375cc60 /SBO-Lib/lib/SBO/Lib | |
parent | 699f7f841418f10aea9ee35d89951e8048fbeafd (diff) | |
download | sbotools2-aa5396514bbcef8f1278e857f7da034611b126a0.tar.xz |
SBO::Lib::Readme: add ask_other_readmes which asks to display other readmes
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib/Readme.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/SBO-Lib/lib/SBO/Lib/Readme.pm b/SBO-Lib/lib/SBO/Lib/Readme.pm index b29558b..f01c923 100644 --- a/SBO-Lib/lib/SBO/Lib/Readme.pm +++ b/SBO-Lib/lib/SBO/Lib/Readme.pm @@ -77,6 +77,21 @@ sub ask_opts { return(); } +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 +198,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. |