From: Sam Vilain Date: Wed, 16 Jul 2008 05:40:30 +0000 (+1200) Subject: Add mechanism for global arguments, and -r option X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=570ac257b2f7b8806b6718e9a2d7426e85b00d22;p=cil.git Add mechanism for global arguments, and -r option --- diff --git a/bin/cil b/bin/cil index f00aee5..f469733 100755 --- 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 diff --git a/lib/CIL.pm b/lib/CIL.pm index 942e27b..732393a 100644 --- a/lib/CIL.pm +++ b/lib/CIL.pm @@ -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) = @_;