Add -v --version command line param to zmfilter.pl

This commit is contained in:
Isaac Connor 2015-01-07 09:00:46 -05:00
parent 94e0ec542a
commit 8ea01e631b
1 changed files with 7 additions and 2 deletions

View File

@ -115,11 +115,12 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
my $delay = $Config{ZM_FILTER_EXECUTE_INTERVAL}; my $delay = $Config{ZM_FILTER_EXECUTE_INTERVAL};
my $event_id = 0; my $event_id = 0;
my $filter_parm = ""; my $filter_parm = "";
my $version = 0;
sub Usage sub Usage
{ {
print( " print( "
Usage: zmfilter.pl [-f <filter name>,--filter=<filter name>] Usage: zmfilter.pl [-f <filter name>,--filter=<filter name>] | -v, --version
Parameters are :- Parameters are :-
-f<filter name>, --filter=<filter name> - The name of a specific filter to run -f<filter name>, --filter=<filter name> - The name of a specific filter to run
"); ");
@ -158,10 +159,14 @@ sub DateTimeToSQL
return( strftime( "%Y-%m-%d %H:%M:%S", localtime( $dt_val ) ) ); return( strftime( "%Y-%m-%d %H:%M:%S", localtime( $dt_val ) ) );
} }
if ( !GetOptions( 'filter=s'=>\$filter_parm ) ) if ( !GetOptions( 'filter=s'=>\$filter_parm, version=>\$version ) )
{ {
Usage(); Usage();
} }
if ( $version ) {
print ZoneMinder::Base::ZM_VERSION . "\n";
exit(0);
}
if ( ! EVENT_PATH ) { if ( ! EVENT_PATH ) {
Error( "No event path defined. Config was $Config{ZM_DIR_EVENTS}\n" ); Error( "No event path defined. Config was $Config{ZM_DIR_EVENTS}\n" );