X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/aefca1ea37be9e98c9ee07be918fa8249212faa8..ccd618998410873f09444c1fb121e3f9decddc8a:/sdk/cli/bin/arv diff --git a/sdk/cli/bin/arv b/sdk/cli/bin/arv index e7d70d8b56..4db95c846f 100755 --- a/sdk/cli/bin/arv +++ b/sdk/cli/bin/arv @@ -10,6 +10,26 @@ if RUBY_VERSION < '1.9.3' then EOS end +# read authentication data from ~/.arvados if present +lineno = 0 +config_file = File.expand_path('~/.arvados') +if File.exist? config_file then + File.open(config_file, 'r').each do |line| + lineno = lineno + 1 + # skip comments + if line.match('^\s*#') then + next + end + var, val = line.chomp.split('=', 2) + # allow environment settings to override config files. + if var and val + ENV[var] ||= val + else + warn "#{config_file}: #{lineno}: could not parse `#{line}'" + end + end +end + case ARGV[0] when 'keep' ARGV.shift @@ -40,6 +60,9 @@ when 'pipeline' "(see arv-run-pipeline-instance --help for details)\n" end abort +when 'tag' + ARGV.shift + exec `which arv-tag`.strip, *ARGV end ENV['ARVADOS_API_VERSION'] ||= 'v1' @@ -228,7 +251,7 @@ def parse_arguments(discovery_document) discovered_params.each do |k,v| k = k.to_sym if ['object', 'array'].index(v["type"]) and method_opts.has_key? k - if method_opts[k].match /^\// + if method_opts[k].andand.match /^\// method_opts[k] = File.open method_opts[k], 'rb' do |f| f.read end end end @@ -252,7 +275,7 @@ request_parameters = {}.merge(method_opts) resource_body = request_parameters.delete(resource_schema.to_sym) if resource_body request_body = { - resource_schema => JSON.parse(resource_body) + resource_schema => resource_body } else request_body = {}