diff --git a/lib/hamlit/cli.rb b/lib/hamlit/cli.rb index e104b249..3c049e50 100644 --- a/lib/hamlit/cli.rb +++ b/lib/hamlit/cli.rb @@ -9,6 +9,11 @@ module Hamlit puts eval(code) end + desc 'compile HAML', 'Show compile result' + def compile(file) + print_code generate_code(file) + end + desc 'parse HAML', 'Show parse result' def parse(file) pp generate_ast(file) @@ -32,6 +37,13 @@ module Hamlit render(args.first.to_s) end + def print_code(code) + require 'pry' + puts Pry.Code(code).highlighted + rescue LoadError + puts code + end + # Enable colored pretty printing only for development environment. def pp(arg) require 'pry'