request_body[:api_token] = ENV['ARVADOS_API_TOKEN']
result = $client.execute(:api_method => method,
:parameters => parameters,
- :body => request_body,
+ :body_object => request_body,
:authenticated => false)
begin
$stderr.puts "no tags found to remove"
end
- return {
- 'kind' => 'arvados#linkList',
- 'items_available' => results.length,
- 'items' => results,
- }
+ return results
end
if RUBY_VERSION < '1.9.3' then
opt :yaml, "Return the response received from the API server, in YAML format", :short => "-y"
stop_on ['add', 'remove']
end
-
+
p = Trollop::Parser.new do
opt(:all,
"Remove this tag from all objects under your ownership. Only valid with `tag remove'.",
results = []
cmd = ARGV.shift
+
+if ARGV.empty?
+ usage
+end
+
case cmd
when 'add'
ARGV.each do |tag|
when 'remove'
ARGV.each do |tag|
if $options[:all] then
- results.push(tag_remove(tag))
+ results.concat tag_remove(tag)
else
- results.push(tag_remove(tag, $options[:object]))
+ results.concat tag_remove(tag, $options[:object])
end
end
else
puts Oj.dump(results)
else
results.each do |r|
- next if r == nil
- if r["items"] and r["kind"].match /list$/i
- r['items'].each do |i| puts i['uuid'] end
- elsif r['uuid'].nil?
+ if r['uuid'].nil?
abort("Response did not include a uuid:\n" +
Oj.dump(r, :indent => 1) +
"\n")