Index: branches/pap/Nebulous/bin/neb-ls
===================================================================
--- branches/pap/Nebulous/bin/neb-ls	(revision 28498)
+++ branches/pap/Nebulous/bin/neb-ls	(revision 28534)
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
 
-# Copyright (C) 2007-2009  Joshua Hoblitt
+# Copyright (C) 2007-2009  Joshua Hoblitt, 2010 Chris Waters
 
 use strict;
@@ -16,18 +16,20 @@
 my (
     $server,
-    $long,
-#    $recursive,
+    $path,
+    $column,
 );
 
 $server = $ENV{'NEB_SERVER'} unless $server;
 
-# make --long the default
-$long = 1;
 
 GetOptions(
     'server|s=s'    => \$server,
-#    'recursive|r'   => \$recursive,
-    'l|1'           => \$long,
+    'path|p'        => \$path,
+    'column|c'      => \$column,
 ) || pod2usage( 2 );
+
+# twiddle column so that it does it by default.
+
+$column = not $column;
 
 my $pattern = shift;
@@ -47,19 +49,27 @@
 $pattern ||= "/";
 
-#if ($recursive) {
-#    $pattern = "^" . $pattern . ".*";
-#} else {
-#    $pattern = "^" . $pattern . "\$";
-#}
+my $keys = $neb->find_objects_wildcard($pattern);
 
-my $keys = $neb->find_objects($pattern);
-
+if ($path) {
+    my @files;
+    foreach my $key (@{ $keys }) {
+	my $uris = $neb->find_instances($key);
+	if (defined $uris) {
+	    push @files, URI->new(@$uris[0])->file;
+	}
+    }
+    @{ $keys } = @files;
+} 
 if ($keys) {
-    if ($long) {
-        print join("\n", @{ $keys }), "\n";
-    } else {
-        print join(" ", @{ $keys }), "\n";
+    if ($column) {
+	open(COLUMN,"|column") || die "Cannot open column command.";
+	print COLUMN join("\n", @{ $keys }), "\n";
+	close(COLUMN);
+    }
+    else {
+	print join("\n", @{ $keys }), "\n";
     }
 }
+
 
 __END__
@@ -73,11 +83,11 @@
 =head1 SYNOPSIS
 
-    neb-ls [--server <URL>] [-l|-1] [--recursive] <pattern>
+    neb-ls [--server <URL>] [-c] [-p] <pattern>
 
 =head1 DESCRIPTION
 
 This program list Nebulous keys matched by C<<pattern>>.  Call it with no
-arguments is equivalanet to searching with the pattern C<.*>.  Where
-C<<pattern>> is a POSIX 1003.2 compatable regular repression.
+arguments is equivalent to searching with the pattern C<neb://>.  SQL like
+wildcards are supported to select out certain files.
 
 =head1 OPTIONS
@@ -85,19 +95,14 @@
 =over 4
 
-=item * -l|-1
+=item * --path|-p
 
-Use a long listing format.
+Find the disk files corresponding to the keys found.
+
+=item * --column|-c
+
+Disable column formatting, and output results one to a line.
 
 Optional
 
-=cut
-#=item * --recursive|-r
-#
-#By default C<neb-ls> will only try to match the exact string provided to it.
-#With this option set all keys which match C<<pattern>> as a REGEX or substring
-#will be returned.
-#
-#Optional
-#
 =item * --server|-s <URL>
 
@@ -122,8 +127,4 @@
 =back
 
-=head1 CREDITS
-
-Just me, myself, and I.
-
 =head1 SUPPORT
 
@@ -132,9 +133,9 @@
 =head1 AUTHOR
 
-Joshua Hoblitt <jhoblitt@cpan.org>
+Joshua Hoblitt <jhoblitt@cpan.org>, Chris Waters
 
 =head1 COPYRIGHT
 
-Copyright (C) 2007-2009  Joshua Hoblitt.  All rights reserved.
+Copyright (C) 2007-2010  Joshua Hoblitt / Chris Waters.  All rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under
