Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add "?" command to menupick

  • Loading branch information...
commit 91cbec200a3ef1512a43c1f2505c9a1605f8f4ec 1 parent d045875
Mark Dominus authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 menupick
View
16 menupick
@@ -26,15 +26,22 @@ if ($opt->{n} > 0 && @item > $opt->{n}) {
exit 2;
}
-for my $i (0 .. $#item) {
- printf $ttyout "%2d. %s\n", $i, $item[$i];
+sub show_menu {
+ for my $i (0 .. $#item) {
+ printf $ttyout "%2d. %s\n", $i, $item[$i];
+ }
}
+show_menu();
my @set = ();
while (1) {
my $in = prompt($ttyin, $ttyout);
last unless $in =~ /\S/;
my $quit = $in =~ s/!\s*$//;
+ if ($in =~ /^\s*\?\s*$/) {
+ print_set($ttyout, @set);
+ next;
+ }
modify($in, \@set);
last if $quit;
}
@@ -66,3 +73,8 @@ sub modify {
}
@$set = sort { $a <=> $b } keys %set;
}
+
+sub print_set {
+ my ($out) = shift;
+ print $out "@_\n";
+}
Please sign in to comment.
Something went wrong with that request. Please try again.