Sha256: a8cfc3f5c61d3bad6317b5c1cd7ff6cb6bee82089eeedb8ca8659403c4b47261

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

#
# Copyright 2013 whiteleaf. All rights reserved.
#

require_relative "../helper"

module Command
  class Folder < CommandBase
    def self.oneline_help
      "小説の保存フォルダを開きます"
    end

    def initialize
      super("<target> [<target2> ...]")
      @opt.separator <<-EOS

  ・指定した小説の保存フォルダを開きます。

  Examples:
    narou folder n9669bk
    narou folder musyoku
    narou folder 0
    narou f 0

  Options:
      EOS
      @opt.on("-n", "--no-open", "フォルダを開かずにパスだけ表示する") {
        @options["no-open"] = true
      }
    end

    def execute(argv)
      super
      display_help! if argv.empty?
      tagname_to_ids(argv)
      argv.each do |target|
        dir = Downloader.get_novel_data_dir_by_target(target)
        if dir
          Helper.open_directory(dir) unless @options["no-open"]
          puts dir
        else
          error "#{target} は存在しません"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
narou-3.9.1 lib/command/folder.rb
narou-3.9.0 lib/command/folder.rb
narou-3.8.2 lib/command/folder.rb
narou-3.8.1 lib/command/folder.rb
narou-3.8.0 lib/command/folder.rb
narou-3.7.2 lib/command/folder.rb