Class: Lutaml::Xsd::Commands::TreeCommand

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

Overview

Tree command for visualizing LXR package contents

Displays package contents in a colorized tree structure with file sizes and categorization. Supports both tree and flat list formats.

Examples:

Basic tree view

TreeCommand.new("pkg/urban_function.lxr", {}).run

With file sizes

TreeCommand.new("pkg/urban_function.lxr", { show_sizes: true }).run

Flat list without colors

TreeCommand.new("pkg/urban_function.lxr", {
  format: "flat",
  no_color: true
}).run

Instance Attribute Summary collapse

Attributes inherited from BaseCommand

#options

Instance Method Summary collapse

Constructor Details

#initialize(package_path, options = {}) ⇒ TreeCommand

Initialize tree command

Parameters:

  • package_path (String)

    Path to .lxr package file

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

    Command options

Options Hash (options):

  • :show_sizes (Boolean)

    Show file sizes

  • :no_color (Boolean)

    Disable colored output

  • :format (String)

    Output format (tree or flat)



35
36
37
38
# File 'lib/lutaml/xsd/commands/tree_command.rb', line 35

def initialize(package_path, options = {})
  super(options)
  @package_path = package_path
end

Instance Attribute Details

#package_pathObject (readonly)

Returns the value of attribute package_path.



26
27
28
# File 'lib/lutaml/xsd/commands/tree_command.rb', line 26

def package_path
  @package_path
end

Instance Method Details

#runvoid

This method returns an undefined value.

Execute the tree command



43
44
45
46
47
48
# File 'lib/lutaml/xsd/commands/tree_command.rb', line 43

def run
  validate_package_file
  display_tree
rescue StandardError => e
  handle_error(e)
end