todo: show memo on empty args
This commit is contained in:
14
todo
14
todo
@@ -1,5 +1,7 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# simple TODO-manager
|
||||
|
||||
use strict;
|
||||
use warnings "all";
|
||||
use 5.10.0;
|
||||
@@ -29,7 +31,6 @@ if ($help) {
|
||||
}
|
||||
|
||||
if ($delete) {
|
||||
say Dumper(\@ARGV);
|
||||
die "NUM not set\n" if ($ARGV[0] !~ /^\d+$/);
|
||||
my @TODO = readtodo();
|
||||
die "NUM too big\n" if ($ARGV[0] > @TODO);
|
||||
@@ -48,11 +49,10 @@ if ($delete) {
|
||||
|
||||
close TD;
|
||||
} else {
|
||||
die "Specify what to put in memo\n" unless (@ARGV > 0);
|
||||
|
||||
my @TODO = readtodo();
|
||||
push @TODO, join(" ", @ARGV);
|
||||
|
||||
if (@ARGV > 0) {
|
||||
push @TODO, join(" ", @ARGV);
|
||||
open (TD, ">", $file) or die "Unable to open $file: $!\n";
|
||||
|
||||
for (my $i = 0; $i < @TODO; $i++) {
|
||||
@@ -62,6 +62,12 @@ if ($delete) {
|
||||
}
|
||||
|
||||
close TD;
|
||||
} else {
|
||||
for (my $i = 0; $i < @TODO; $i++) {
|
||||
next unless (defined($TODO[$i]));
|
||||
print sprintf("%s. %s\n", $i, $TODO[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
Reference in New Issue
Block a user