18870: Need to declare NODES as array
[arvados.git] / sdk / cli / bin / arv-tag
index 5196d03bc23df12affff8b9acc3e3f4cfb8a9b0b..f709020fc75e91a3449adceabfebd31e02dca13d 100755 (executable)
@@ -1,4 +1,7 @@
 #! /usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
 
 # arv tag usage:
 #   arv tag add tag1 [tag2 ...] --object obj_uuid1 [--object obj_uuid2 ...]
@@ -101,7 +104,8 @@ $arvados_api_host = ENV['ARVADOS_API_HOST'] or
   abort "#{$0}: fatal: ARVADOS_API_HOST environment variable not set."
 $arvados_api_token = ENV['ARVADOS_API_TOKEN'] or
   abort "#{$0}: fatal: ARVADOS_API_TOKEN environment variable not set."
-$arvados_api_host_insecure = ENV['ARVADOS_API_HOST_INSECURE'] == 'yes'
+$arvados_api_host_insecure = %w(1 true yes).
+  include?((ENV['ARVADOS_API_HOST_INSECURE'] || "").downcase)
 
 begin
   require 'rubygems'
@@ -109,11 +113,11 @@ begin
   require 'json'
   require 'pp'
   require 'oj'
-  require 'trollop'
+  require 'optimist'
 rescue LoadError
   abort <<-EOS
 #{$0}: fatal: some runtime dependencies are missing.
-Try: gem install pp google-api-client json trollop
+Try: gem install pp google-api-client json optimist
   EOS
 end
 
@@ -152,7 +156,7 @@ class Google::APIClient
   end
 end
 
-global_opts = Trollop::options do
+global_opts = Optimist::options do
   banner usage_string
   banner ""
   opt :dry_run, "Don't actually do anything", :short => "-n"
@@ -165,7 +169,7 @@ global_opts = Trollop::options do
   stop_on ['add', 'remove']
 end
 
-p = Trollop::Parser.new do
+p = Optimist::Parser.new do
   opt(:all,
       "Remove this tag from all objects under your ownership. Only valid with `tag remove'.",
       :short => :none)
@@ -176,7 +180,7 @@ p = Trollop::Parser.new do
       :short => :o)
 end
 
-$options = Trollop::with_standard_exception_handling p do
+$options = Optimist::with_standard_exception_handling p do
   p.parse ARGV
 end