Class: SyntaxTree::CLI::Format

Inherits:
Action
  • Object
show all
Defined in:
lib/syntax_tree/cli.rb

Overview

An action of the CLI that formats the input source and prints it out.

Instance Attribute Summary

Attributes inherited from Action

#options

Instance Method Summary collapse

Methods inherited from Action

#failure, #initialize, #success

Constructor Details

This class inherits a constructor from SyntaxTree::CLI::Action

Instance Method Details

#run(item) ⇒ Object



312
313
314
315
316
317
318
319
320
321
# File 'lib/syntax_tree/cli.rb', line 312

def run(item)
  formatted =
    item.handler.format(
      item.source,
      options.print_width,
      options: options.formatter_options
    )

  puts formatted
end