watson-ruby
watson-ruby copied to clipboard
Should we clean the dir before adding here? [lib/watson/command.rb]
filename : lib/watson/command.rb line # : 269 tag : review md5 : d80c71d6d9f52b99a0eb046266425638
# [review] - Should we clean the dir before adding here?
# For each argument passed, make sure valid, then add to @config.dir_list
args.each do | _dir |
# Error check on input
if !Watson::FS.check_dir(_dir)
print "Unable to open #{ _dir }\n"
else
# Clean up directory path
_dir = _dir.match(/^((\w+)?\.?\/?)+/)[0].gsub(/(\/)+$/, "")
if !_dir.empty?
debug_print "Adding #{ _dir } to config dir_list\n"
@config.dir_list.push(_dir)
end
end
end
debug_print "Updated dirs: #{ @config.dir_list }\n"