Class: SyntaxTree::CLI::Check

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

Overview

An action of the CLI that ensures that the filepath is formatted as expected.

Defined Under Namespace

Classes: UnformattedError

Instance Method Summary collapse

Instance Method Details

#failureObject



73
74
75
# File 'lib/syntax_tree/cli.rb', line 73

def failure
  warn("The listed files did not match the expected format.")
end

#run(handler, filepath, source) ⇒ Object



62
63
64
65
66
67
# File 'lib/syntax_tree/cli.rb', line 62

def run(handler, filepath, source)
  raise UnformattedError if source != handler.format(source)
rescue StandardError
  warn("[#{Color.yellow("warn")}] #{filepath}")
  raise
end

#successObject



69
70
71
# File 'lib/syntax_tree/cli.rb', line 69

def success
  puts("All files matched expected format.")
end