Class: Excavate::CLI
- Inherits:
-
Thor
- Object
- Thor
- Excavate::CLI
- Defined in:
- lib/excavate/cli.rb
Constant Summary collapse
- STATUS_SUCCESS =
0- STATUS_UNKNOWN_ERROR =
1- STATUS_TARGET_EXISTS =
2- STATUS_TARGET_NOT_EMPTY =
3- STATUS_TARGET_NOT_FOUND =
4- ERROR_TO_STATUS =
{ TargetExistsError => STATUS_TARGET_EXISTS, TargetNotEmptyError => STATUS_TARGET_NOT_EMPTY, TargetNotFoundError => STATUS_TARGET_NOT_FOUND, }.freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
17 18 19 |
# File 'lib/excavate/cli.rb', line 17 def self.exit_on_failure? false end |
.start(given_args = ARGV, config = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/excavate/cli.rb', line 21 def self.start(given_args = ARGV, config = {}) args = if all_commands.key?(given_args[0]) given_args else given_args.dup.unshift("extract") end super(args, config) end |
Instance Method Details
#extract(archive, *files) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/excavate/cli.rb', line 37 def extract(archive, *files) target = Excavate::Archive.new(archive).extract( recursive_packages: [:recursive], files: files, filter: [:filter], ) success("Successfully extracted to #{format_paths(target)}") rescue Error => e handle_error(e) end |