From 87419b018c25adc07bf563b2783739eb2734ea74 Mon Sep 17 00:00:00 2001 From: Tatsuki Sugiura Date: Thu, 26 May 2016 17:45:11 +0900 Subject: [PATCH] Allow multiple argument to upload. --- ChangeLog | 5 +++++ lib/osdn/cli/command/frs_upload.rb | 8 +++++++- lib/osdn/cli/command/relfile.rb | 12 +++++++++--- lib/osdn/cli/version.rb | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d91360..2daefd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-05-26 Tatsuki Sugiura + + * Version 0.1.3 + * frs_uplaod, relfile: Allow multiple target arguments. + 2016-05-18 Tatsuki Sugiura * Version 0.1.2 diff --git a/lib/osdn/cli/command/frs_upload.rb b/lib/osdn/cli/command/frs_upload.rb index 97c1793..ae112c3 100644 --- a/lib/osdn/cli/command/frs_upload.rb +++ b/lib/osdn/cli/command/frs_upload.rb @@ -46,7 +46,13 @@ module OSDN; module CLI; module Command end end - @target_dir = Pathname.new(ARGV.shift || '.') + (ARGV.empty? ? ['.'] : ARGV).each do |d| + @target_dir = Pathname.new(d) + process_target + end + end + + def process_target proj_info = api.get_project target_proj # check project existance vars = load_variables(@target_dir) diff --git a/lib/osdn/cli/command/relfile.rb b/lib/osdn/cli/command/relfile.rb index 6ea473e..6b612e6 100644 --- a/lib/osdn/cli/command/relfile.rb +++ b/lib/osdn/cli/command/relfile.rb @@ -5,7 +5,7 @@ module OSDN; module CLI; module Command class Relfile < FrsBase def help puts "#{$0} relfile [opts] [list]" - puts "#{$0} relfile [opts] create " + puts "#{$0} relfile [opts] create [target-files...]" puts "#{$0} relfile [opts] update " puts "#{$0} relfile [opts] delete " puts "Options:" @@ -69,12 +69,18 @@ module OSDN; module CLI; module Command end def create - filename = ARGV.shift - if !filename + if ARGV.empty? || ARGV.first == "" logger.fatal "Target filename is missing." help return end + + ARGV.each do |f| + create_one(f) + end + end + + def create_one(filename) file = Pathname('.') + filename logger.debug "Calculating digest for #{file}..." diff --git a/lib/osdn/cli/version.rb b/lib/osdn/cli/version.rb index 8d3d4e5..ecb1132 100644 --- a/lib/osdn/cli/version.rb +++ b/lib/osdn/cli/version.rb @@ -1,5 +1,5 @@ module OSDN module CLI - VERSION = "0.1.2" + VERSION = "0.1.3" end end -- 2.11.0