Class: SyntaxTree::CLI::Check
Overview
An action of the CLI that ensures that the filepath is formatted as expected.
Defined Under Namespace
Classes: UnformattedError
Instance Attribute Summary
Attributes inherited from Action
Instance Method Summary collapse
Methods inherited from Action
Constructor Details
This class inherits a constructor from SyntaxTree::CLI::Action
Instance Method Details
#failure ⇒ Object
116 117 118 |
# File 'lib/syntax_tree/cli.rb', line 116 def failure warn("The listed files did not match the expected format.") end |
#run(item) ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/syntax_tree/cli.rb', line 102 def run(item) source = item.source if source != item.handler.format(source, .print_width) raise UnformattedError end rescue StandardError warn("[#{Color.yellow("warn")}] #{item.filepath}") raise end |
#success ⇒ Object
112 113 114 |
# File 'lib/syntax_tree/cli.rb', line 112 def success puts("All files matched expected format.") end |