[Bps-public-commit] r16081 - in Prophet/branches/dispatcher: lib/Prophet/CLI

sartak at bestpractical.com sartak at bestpractical.com
Thu Sep 25 18:48:33 EDT 2008


Author: sartak
Date: Thu Sep 25 18:48:32 2008
New Revision: 16081

Modified:
   Prophet/branches/dispatcher/   (props changed)
   Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm

Log:
 r72497 at onn:  sartak | 2008-09-25 18:38:57 -0400
 config command


Modified: Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm
==============================================================================
--- Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm	(original)
+++ Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm	Thu Sep 25 18:48:32 2008
@@ -109,6 +109,28 @@
     );
 };
 
+on config => sub {
+    my $self = shift;
+
+    my $config = $self->cli->config;
+
+    print "Configuration:\n\n";
+    my @files = @{$config->config_files};
+    if (!scalar @files) {
+        print $self->no_config_files;
+        return;
+    }
+
+    print "Config files:\n\n";
+    for my $file (@files) {
+        print "$file\n";
+    }
+
+    print "\nYour configuration:\n\n";
+    for my $item ($config->list) {
+        print $item ." = ".$config->get($item)."\n";
+    }
+};
 
 # catch-all. () makes sure we don't hit the annoying historical feature of
 # the empty regex meaning the last-used regex
@@ -136,6 +158,14 @@
     return $server;
 }
 
+sub no_config_files {
+    my $self = shift;
+    return "No configuration files found. "
+         . " Either create a file called 'prophetrc' inside of "
+         . $self->handle->fs_root
+         . " or set the PROPHET_APP_CONFIG environment variable.\n\n";
+}
+
 no Moose;
 __PACKAGE__->meta->make_immutable;
 



More information about the Bps-public-commit mailing list