whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] 02/02: Check for valid options
Date Fri, 05 Jun 2020 11:00:01 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

commit 505e7d465ec189dce056af5dcc26cf2cc4ec9805
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Jun 5 11:59:42 2020 +0100

    Check for valid options
---
 lib/whimsy/asf/svn.rb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 480bda6..5d3ec31 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -261,6 +261,7 @@ module ASF
       return self.svn('list', path, {user: user, password: password})
     end
 
+    VALID_KEYS=[:args, :user, :password, :verbose]
     # low level SVN command
     # params:
     # command - info, list etc
@@ -275,6 +276,11 @@ module ASF
     def self.svn(command, path , options = {})
       return nil, 'command must not be nil' unless command
       return nil, 'path must not be nil' unless path
+      
+      bad_keys = options.keys - VALID_KEYS
+      if bad_keys.size > 0
+        return nil, "Following options not recognised: #{bad_keys.inspect}"
+      end
 
       # build svn command
       cmd = ['svn', command, path, '--non-interactive']


Mime
View raw message