Class: Command::Folder

Inherits:
CommandBase show all
Defined in:
lib/command/folder.rb

Instance Attribute Summary

Attributes inherited from CommandBase

#stream_io

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CommandBase

#disable_logging, #display_help!, execute!, #execute!, #force_change_settings_function, help, #hook_call, #load_local_settings, #tagname_to_ids

Constructor Details

#initializeFolder

Returns a new instance of Folder.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/command/folder.rb', line 15

def initialize
  super("<target> [<target2> ...]")
  @opt.separator "\n  \u30FB\u6307\u5B9A\u3057\u305F\u5C0F\u8AAC\u306E\u4FDD\u5B58\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u304D\u307E\u3059\u3002\n\n  Examples:\nnarou folder n9669bk\nnarou folder musyoku\nnarou folder 0\nnarou f 0\n\n  Options:\n  EOS\n  @opt.on(\"-n\", \"--no-open\", \"\u30D5\u30A9\u30EB\u30C0\u3092\u958B\u304B\u305A\u306B\u30D1\u30B9\u3060\u3051\u8868\u793A\u3059\u308B\") {\n    @options[\"no-open\"] = true\n  }\nend\n"

Class Method Details

.oneline_helpObject



11
12
13
# File 'lib/command/folder.rb', line 11

def self.oneline_help
  "小説の保存フォルダを開きます"
end

Instance Method Details

#execute(argv) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/command/folder.rb', line 34

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