Class: LeechtopDownloader::CLI
- Inherits:
-
Thor
- Object
- Thor
- LeechtopDownloader::CLI
- Extended by:
- T::Sig
- Includes:
- CLIHelpers
- Defined in:
- lib/leechtop_downloader/cli.rb
Overview
CLI is the Thor application for handling commands.
Class Method Summary collapse
-
.exit_on_failure? ⇒ T::Boolean
Ensure Thor exits with an error status on failure.
Instance Method Summary collapse
-
#download(*urls) ⇒ Object
LT-REQ-001, LT-REQ-002 Main entry point to download files.
Methods included from CLIHelpers
#acquire_lock, #fix_encoding, #lock_path_for, #skip_download?, #skip_locked, #with_app_lock
Class Method Details
.exit_on_failure? ⇒ T::Boolean
Ensure Thor exits with an error status on failure.
19 20 21 |
# File 'lib/leechtop_downloader/cli.rb', line 19 def self.exit_on_failure? true end |
Instance Method Details
#download(*urls) ⇒ Object
LT-REQ-001, LT-REQ-002 Main entry point to download files.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/leechtop_downloader/cli.rb', line 29 def download(*urls) if urls.empty? puts 'Error: You must provide at least one URL or file path.' exit 1 end with_app_lock do skip_existing = .fetch(:skip_existing, true) destination = .fetch(:destination, '.') urls.each { |arg| process_argument(arg, skip_existing, destination) } end end |