Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions lib/herb/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Herb::CLI
include Herb::Colors

attr_accessor :json, :silent, :no_interactive, :no_log_file, :no_timing, :local, :escape, :no_escape, :freeze, :debug, :tool, :strict
attr_accessor :json, :silent, :no_interactive, :no_log_file, :no_timing, :local, :escape, :no_escape, :freeze, :debug, :tool, :strict, :analyze, :track_whitespace

def initialize(args)
@args = args
Expand Down Expand Up @@ -144,7 +144,7 @@ def result
show_config
exit(0)
when "parse"
Herb.parse(file_content, strict: strict.nil? || strict)
Herb.parse(file_content, strict: strict.nil? || strict, analyze: analyze.nil? || analyze, track_whitespace: track_whitespace || false)
when "compile"
compile_template
when "render"
Expand Down Expand Up @@ -261,6 +261,18 @@ def option_parser
self.strict = false
end

parser.on("--analyze", "Enable analyze mode (for parse command) (default: true)") do
self.analyze = true
end

parser.on("--no-analyze", "Disable analyze mode (for parse command)") do
self.analyze = false
end

parser.on("--track-whitespace", "Enable whitespace tracking (for parse command) (default: false)") do
self.track_whitespace = true
end

parser.on("--tool TOOL", "Show config for specific tool: linter, formatter (for config command)") do |t|
self.tool = t.to_sym
end
Expand Down
Loading