Class: Lutaml::Xsd::Commands::StatsCommand::ShowCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/lutaml/xsd/commands/stats_command.rb

Overview

Command class for showing repository statistics

Instance Attribute Summary

Attributes inherited from BaseCommand

#options

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}) ⇒ ShowCommand

Returns a new instance of ShowCommand.



51
52
53
54
55
# File 'lib/lutaml/xsd/commands/stats_command.rb', line 51

def initialize(path, options = {})
  super(options)
  @path = path
  @format = options[:format] || "text"
end

Instance Method Details

#runObject



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/lutaml/xsd/commands/stats_command.rb', line 57

def run
  repository = load_repository(@path)
  ensure_resolved(repository)

  stats = repository.statistics
  output_statistics(stats)
rescue StandardError => e
  error("Failed to display statistics: #{e.message}")
  verbose_output(e.backtrace.join("\n")) if verbose?
  exit 1
end