Class: Command::Folder

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CommandBase

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

Constructor Details

#initializeFolder

Returns a new instance of Folder.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/command/folder.rb', line 14

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

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

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

Class Method Details

.oneline_helpObject



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

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

Instance Method Details

#execute(argv) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/command/folder.rb', line 28

def execute(argv)
  super
  if argv.empty?
    puts @opt.help
    return
  end
  tagname_to_ids(argv)
  argv.each do |target|
    dir = Downloader.get_novel_data_dir_by_target(target)
    if dir
      Helper.open_directory(dir)
      puts dir
    else
      error "#{target} は存在しません"
    end
  end
end