Class: Omnizip::Commands::ArchiveListCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/omnizip/commands/archive_list_command.rb

Overview

Command to list contents of .7z archives.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ArchiveListCommand

Initialize archive list command with options.

Parameters:

  • options (Hash) (defaults to: {})

    Command options from Thor



28
29
30
# File 'lib/omnizip/commands/archive_list_command.rb', line 28

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



23
24
25
# File 'lib/omnizip/commands/archive_list_command.rb', line 23

def options
  @options
end

Instance Method Details

#run(archive_file) ⇒ void

This method returns an undefined value.

Execute the archive list command.

Parameters:

  • archive_file (String)

    Path to .7z archive



36
37
38
39
40
41
42
43
44
45
# File 'lib/omnizip/commands/archive_list_command.rb', line 36

def run(archive_file)
  validate_input(archive_file)

  verbose = options[:verbose] || false
  patterns = Array(options[:pattern]) if options[:pattern]
  excludes = Array(options[:exclude]) if options[:exclude]
  count_only = options[:count] || false

  list_archive(archive_file, verbose, patterns, excludes, count_only)
end