OSDN Git Service

Version 0.1.4: frs_uplaod, relfile: Allow multiple target arguments.
[osdn-codes/osdn-cli.git] / lib / osdn / cli / command / frs_upload.rb
index ae112c3..601964f 100644 (file)
@@ -10,6 +10,8 @@ module OSDN; module CLI; module Command
       puts "  -v --visibility=<public|private|hidden>"
       puts "                             Default visibility for newly created items"
       puts "      --force-digest         Calc local file digest forcely"
       puts "  -v --visibility=<public|private|hidden>"
       puts "                             Default visibility for newly created items"
       puts "      --force-digest         Calc local file digest forcely"
+      puts "      --progress             Force to show upload progress"
+      puts "      --no-progress          Force to hide upload progress"
     end
 
     def run
     end
 
     def run
@@ -21,6 +23,8 @@ module OSDN; module CLI; module Command
         [ '--release', GetoptLong::REQUIRED_ARGUMENT ],
         [ '--visibility', '-v', GetoptLong::REQUIRED_ARGUMENT ],
         [ '--force-digest', GetoptLong::NO_ARGUMENT],
         [ '--release', GetoptLong::REQUIRED_ARGUMENT ],
         [ '--visibility', '-v', GetoptLong::REQUIRED_ARGUMENT ],
         [ '--force-digest', GetoptLong::NO_ARGUMENT],
+        [ '--progress', GetoptLong::NO_ARGUMENT],
+        [ '--no-progress', GetoptLong::NO_ARGUMENT],
       )
       opts.each do |opt, arg|
         case opt
       )
       opts.each do |opt, arg|
         case opt
@@ -43,6 +47,10 @@ module OSDN; module CLI; module Command
           @force_digest = true
         when '--dry-run'
           @dry_run = true
           @force_digest = true
         when '--dry-run'
           @dry_run = true
+        when '--progress'
+          @show_progress = true
+        when '--no-progress'
+          @show_progress = false
         end
       end
 
         end
       end
 
@@ -182,7 +190,7 @@ module OSDN; module CLI; module Command
       if @dry_run
         finfo = Hashie::Mash.new id: '(dry-run)', url: '(dry-run)'
       else
       if @dry_run
         finfo = Hashie::Mash.new id: '(dry-run)', url: '(dry-run)'
       else
-        logger.level <= Logger::INFO and
+        logger.level <= Logger::INFO && @show_progress != false || @show_progress and
           OSDN::CLI._show_progress = true
         fio = file.open
         logger.info "Starting upload #{file}..."
           OSDN::CLI._show_progress = true
         fio = file.open
         logger.info "Starting upload #{file}..."