Index: /branches/neb_distrib_20081210/Nebulous/bin/neb-ls
===================================================================
--- /branches/neb_distrib_20081210/Nebulous/bin/neb-ls	(revision 23874)
+++ /branches/neb_distrib_20081210/Nebulous/bin/neb-ls	(revision 23875)
@@ -1,7 +1,5 @@
 #!/usr/bin/env perl
 
-# Copyright (C) 2007-2008  Joshua Hoblitt
-#
-# $Id: neb-ls,v 1.7 2008-06-12 20:03:37 jhoblitt Exp $
+# Copyright (C) 2007-2009  Joshua Hoblitt
 
 use strict;
@@ -9,5 +7,5 @@
 
 use vars qw( $VERSION );
-$VERSION = '0.02';
+$VERSION = '0.03';
 
 use Nebulous::Client;
@@ -16,5 +14,9 @@
 use Pod::Usage qw( pod2usage );
 
-my ($server, $long, $recursive);
+my (
+    $server,
+    $long,
+#    $recursive,
+);
 
 $server = $ENV{'NEB_SERVER'} unless $server;
@@ -22,5 +24,5 @@
 GetOptions(
     'server|s=s'    => \$server,
-    'recursive|r'   => \$recursive,
+#    'recursive|r'   => \$recursive,
     'l|1'           => \$long,
 ) || pod2usage( 2 );
@@ -39,12 +41,12 @@
     unless defined $neb;
 
-# default to listing everything (bad idea?)
-$pattern ||= ".*";
+# default to listing root
+$pattern ||= "/";
 
-if ($recursive) {
-    $pattern = "^" . $pattern . ".*";
-} else {
-    $pattern = "^" . $pattern . "\$";
-}
+#if ($recursive) {
+#    $pattern = "^" . $pattern . ".*";
+#} else {
+#    $pattern = "^" . $pattern . "\$";
+#}
 
 my $keys = $neb->find_objects($pattern);
@@ -86,12 +88,13 @@
 Optional
 
-=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
-
+=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>
 
@@ -130,5 +133,5 @@
 =head1 COPYRIGHT
 
-Copyright (C) 2007-2008  Joshua Hoblitt.  All rights reserved.
+Copyright (C) 2007-2009  Joshua Hoblitt.  All rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under
Index: /branches/neb_distrib_20081210/Nebulous/t/70_neb-ls.t
===================================================================
--- /branches/neb_distrib_20081210/Nebulous/t/70_neb-ls.t	(revision 23874)
+++ /branches/neb_distrib_20081210/Nebulous/t/70_neb-ls.t	(revision 23875)
@@ -2,12 +2,4 @@
 
 # Copyright (C) 2009  Joshua Hoblitt
-
-use strict;
-use warnings;
-
-use lib qw( ./lib ./t );
-
-use Test::Cmd;
-use Test::More tests => 3;
 
 =head1 NAME
@@ -21,4 +13,20 @@
 =cut
 
+use strict;
+use warnings;
+
+use Apache::Test qw( -withtestmore );
+plan tests => 31;
+
+use lib qw( ./lib ./t );
+
+use Test::Cmd;
+use Nebulous::Client;
+use Test::Nebulous;
+
+my $hostport = Apache::Test->config->{ 'hostport' };
+my $neb_url  = "http://$hostport/nebulous";
+
+
 my $cmd = 'bin/neb-ls';
 
@@ -26,12 +34,167 @@
 chmod 0755, 'bin/neb-ls';
 
-
 my $test = Test::Cmd->new(prog => $cmd, workdir => '');
 isa_ok($test, 'Test::Cmd');
 
+# NEB_SERVER env var not set
+Test::Nebulous->setup;
+
 {
     $test->run(args => '');
     missing_args(2, "Required options: --server");
 }
+
+# NEB_SERVER set
+Test::Nebulous->setup;
+
+{
+    $ENV{NEB_SERVER} = $neb_url;
+
+    $test->run(args => '');
+    is($? >> 8, 0, "exit code");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+
+    $test->run(args => '');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^foo$/,      "stdout");
+    like($test->stderr, qr/^$/,         "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+    $neb->create('bar');
+
+    $test->run(args => '');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^foo bar$/,  "stdout");
+    like($test->stderr, qr/^$/,         "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+    $neb->create('bar');
+
+    $test->run(args => '-l');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^foo\nbar\n$/,   "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+    $neb->create('bar');
+
+    $test->run(args => '-1');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^foo\nbar\n$/,   "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+
+    $test->run(args => '');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr||,               "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+
+    $test->run(args => 'a');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/foo$|,        "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+    $neb->create('a/bar');
+
+    $test->run(args => 'a');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/foo a/bar$|,  "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+    $neb->create('foo');
+
+    $test->run(args => 'a');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/foo$|,        "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+    $neb->create('a/b/foo');
+
+    $test->run(args => 'a');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/foo$|,        "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->cleanup;
 
 sub missing_args
