Skip to content

Commit 5984eb8

Browse files
authored
Ruby CLI: Add --action-view-helpers flag for Action View Helpers (#1428)
This pull request adds a new `--action-view-helpers` CLI flag to the Ruby CLI that passes along the `action_view_helpers: true` parser option to `Herb.parse`.
1 parent 6a80ca4 commit 5984eb8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/herb/cli.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Herb::CLI
99
include Herb::Colors
1010

11-
attr_accessor :json, :silent, :log_file, :no_timing, :local, :escape, :no_escape, :freeze, :debug, :tool, :strict, :analyze, :track_whitespace, :verbose, :isolate, :arena_stats, :leak_check
11+
attr_accessor :json, :silent, :log_file, :no_timing, :local, :escape, :no_escape, :freeze, :debug, :tool, :strict, :analyze, :track_whitespace, :verbose, :isolate, :arena_stats, :leak_check, :action_view_helpers
1212

1313
def initialize(args)
1414
@args = args
@@ -160,7 +160,7 @@ def result
160160
show_config
161161
exit(0)
162162
when "parse"
163-
Herb.parse(file_content, strict: strict.nil? || strict, analyze: analyze.nil? || analyze, track_whitespace: track_whitespace || false, arena_stats: arena_stats)
163+
Herb.parse(file_content, strict: strict.nil? || strict, analyze: analyze.nil? || analyze, track_whitespace: track_whitespace || false, arena_stats: arena_stats, action_view_helpers: action_view_helpers || false)
164164
when "compile"
165165
compile_template
166166
when "render"
@@ -298,6 +298,10 @@ def option_parser
298298
self.track_whitespace = true
299299
end
300300

301+
parser.on("--action-view-helpers", "Enable Action View helper detection (for parse command) (default: false)") do
302+
self.action_view_helpers = true
303+
end
304+
301305
parser.on("--tool TOOL", "Show config for specific tool: linter, formatter (for config command)") do |t|
302306
self.tool = t.to_sym
303307
end

0 commit comments

Comments
 (0)