]> git.mjollnir.org Git - cil.git/commitdiff
Add mechanism for global arguments, and -r option
authorSam Vilain <sam.vilain@catalyst.net.nz>
Wed, 16 Jul 2008 05:40:30 +0000 (17:40 +1200)
committerSam Vilain <sam.vilain@catalyst.net.nz>
Wed, 16 Jul 2008 05:40:30 +0000 (17:40 +1200)
bin/cil
lib/CIL.pm

diff --git a/bin/cil b/bin/cil
index f00aee52b36746969bf2587b3e63506a5ea732d0..f469733395e3766659f14a5d6662f4df408e969e 100755 (executable)
--- a/bin/cil
+++ b/bin/cil
@@ -55,6 +55,8 @@ my @IN_OPTS = (
     'created-by>c', # for 'summary', 'list'
     'a=s',          # a = assigned_to
     'assigned-to>a',# for 'summary', 'list'
+    'r=s',          # r = revision
+    'revision>s',   # for all query commands
 
     # booleans
     'bare',         # for 'init'
@@ -105,6 +107,7 @@ my %BOOLEAN_ARGS = (
     my $cil = CIL->new();
     $cil->read_config_user();
     $cil->read_config_file();
+    $cil->check_args($args);
 
     # add any hooks we want
     # none yet
index 942e27b1cae57522c793235b55252f5dec478610..732393ad754349ad424f8a245831b4991b82694a 100644 (file)
@@ -278,6 +278,18 @@ sub read_config_file {
     $self->vcs( $vcs );
 }
 
+sub check_args {
+    my ($self, $args) = @_;
+
+    if ( $args->{r} ) {
+       $self->vcs_revision($args->{r});
+       if ( !$self->VCS or $self->VCS eq "Null" ) {
+           warn "No VCS set in config file!\n";
+       }
+    }
+}
+
+
 sub register_hook {
     my ($self, $hook_name, $code) = @_;