Class: MyManga::CLI::Commands::Zine
- Inherits:
-
MyManga::CLI::Command
- Object
- Hanami::CLI::Command
- MyManga::CLI::Command
- MyManga::CLI::Commands::Zine
- Defined in:
- lib/my_manga/zine.rb
Overview
See desc
Constant Summary collapse
- TMP_DIR =
File.('../../tmp', __dir__)
- RECOVERY_FILE =
File.('../../zine-recovery.yaml', __dir__)
Instance Method Summary collapse
Methods inherited from MyManga::CLI::Command
Instance Method Details
#call(names: nil, **options) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/my_manga/zine.rb', line 34 def call(names: nil, **) names = manga_names(names) filename = .fetch(:filename) { nil } size = .fetch(:size).to_i if [:add] && [:remove] puts "--add and --remove are mutually exclusive" exit 1 end if [:recover] == false && File.exist?(RECOVERY_FILE) File.delete(RECOVERY_FILE) end if [:add] MyManga.add_to_zine(names) puts %("#{names.join(', ')}" added to the zine!) elsif [:remove] MyManga.remove_from_zine(names) puts %("#{names.join(', ')}" removed from the zine!) else publish(filename, size) end end |