summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoeyh <joeyh>2006-07-13 21:10:34 +0000
committerjoeyh <joeyh>2006-07-13 21:10:34 +0000
commit3095ba17495d0f1871900fcc1c87e6efe9f55f18 (patch)
tree542fc088419483135e010c8f7a4a8d7420c1bb88
parent987dac354dbcb7367addc40d69c51bc61897f9ee (diff)
downloadmoreutils-3095ba17495d0f1871900fcc1c87e6efe9f55f18.tar.gz
* vidir: Don't abort if it sees an empty or all-whitespace line.
* vidir: If just a filename is removed and the number is left, treat this the same as removing the whole line, and delete the file, instead of trying to rename the file to "". * vidir: Remove the periods after the item numbers. * vidir: Man page improvements. Closes: #378122
-rw-r--r--debian/changelog10
-rwxr-xr-xvidir18
2 files changed, 21 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index 8b4eb28..679d7cd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
moreutils (0.15) UNRELEASED; urgency=low
* Remove notes about potential tools from README, moved to wiki.
-
- -- Joey Hess <joeyh@debian.org> Thu, 13 Jul 2006 12:21:38 -0400
+ * vidir: Don't abort if it sees an empty or all-whitespace line.
+ * vidir: If just a filename is removed and the number is left,
+ treat this the same as removing the whole line, and delete the file,
+ instead of trying to rename the file to "".
+ * vidir: Remove the periods after the item numbers.
+ * vidir: Man page improvements. Closes: #378122
+
+ -- Joey Hess <joeyh@debian.org> Thu, 13 Jul 2006 16:58:20 -0400
moreutils (0.14) unstable; urgency=low
diff --git a/vidir b/vidir
index 3e2f83a..f8227b1 100755
--- a/vidir
+++ b/vidir
@@ -11,9 +11,13 @@ B<vidir> [--verbose] [directory|file|-] ...
=head1 DESCRIPTION
vidir allows editing of the contents of a directory in a text editor. If no
-directory is specified, the current directory is edited. Each item in the
-directory is listed. Delete items to remove them from the directory, or
-edit their names to rename them.
+directory is specified, the current directory is edited.
+
+When editing a directory, each item in the directory will appear on its own
+numbered line. These numbers are how vidir keeps track of what items are
+changed. Delete lines to remove files from the directory, or
+edit filenames to rename files. You can also switch pairs of numbers to
+swap filenames.
Note that if "-" is specified as the directory to edit, it reads a list of
filenames from stdin and displays those for editing. Alternatively, a list
@@ -94,7 +98,7 @@ my $c=0;
foreach (@dir) {
next if /(.*\/)?\.$/ || /(.*\/)?\.\.$/;
$item{++$c}=$_;
- print OUT "$c.\t$_\n";
+ print OUT "$c\t$_\n";
}
@dir=();
close OUT;
@@ -114,7 +118,7 @@ if ($ret != 0) {
open (IN, $tmp->filename) || die "$0: cannot read ".$tmp->filename.": $!\n";
while (<IN>) {
chomp;
- if (/^(\d+)\.\t(.*)/) {
+ if (/^(\d+)\t{0,1}(.*)/) {
my $num=$1;
my $name=$2;
if (! exists $item{$num}) {
@@ -122,6 +126,7 @@ while (<IN>) {
$error=1;
}
elsif ($name ne $item{$num}) {
+ next unless length $name;
my $src=$item{$num};
# deal with swaps
@@ -156,6 +161,9 @@ while (<IN>) {
}
delete $item{$num};
}
+ elsif (/^\s*$/) {
+ # skip empty line
+ }
else {
die "$0: unable to parse line \"$_\", aborting\n";
}