Skip to content

Commit fdcb81d

Browse files
justin808claude
andcommitted
Fix bin/dev --verbose option causing error
The --verbose flag was documented in bin/dev --help but not implemented in the OptionParser, causing an error when used. This fix: - Adds verbose: false to the options hash - Implements --verbose/-v flag parsing in OptionParser - Updates all start() calls to use options[:verbose] instead of hardcoded false - Adds RuboCop disable comment for increased AbcSize metric Closes #1849 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent cbee429 commit fdcb81d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/react_on_rails/dev/server_manager.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,11 @@ def show_help
144144
puts help_troubleshooting
145145
end
146146

147+
# rubocop:disable Metrics/AbcSize
147148
def run_from_command_line(args = ARGV)
148149
require "optparse"
149150

150-
options = { route: nil, rails_env: nil }
151+
options = { route: nil, rails_env: nil, verbose: false }
151152

152153
OptionParser.new do |opts|
153154
opts.banner = "Usage: dev [command] [options]"
@@ -160,6 +161,10 @@ def run_from_command_line(args = ARGV)
160161
options[:rails_env] = env
161162
end
162163

164+
opts.on("-v", "--verbose", "Enable verbose output for pack generation") do
165+
options[:verbose] = true
166+
end
167+
163168
opts.on("-h", "--help", "Prints this help") do
164169
show_help
165170
exit
@@ -172,21 +177,23 @@ def run_from_command_line(args = ARGV)
172177
# Main execution
173178
case command
174179
when "production-assets", "prod"
175-
start(:production_like, nil, verbose: false, route: options[:route], rails_env: options[:rails_env])
180+
start(:production_like, nil, verbose: options[:verbose], route: options[:route],
181+
rails_env: options[:rails_env])
176182
when "static"
177-
start(:static, "Procfile.dev-static-assets", verbose: false, route: options[:route])
183+
start(:static, "Procfile.dev-static-assets", verbose: options[:verbose], route: options[:route])
178184
when "kill"
179185
kill_processes
180186
when "help", "--help", "-h"
181187
show_help
182188
when "hmr", nil
183-
start(:development, "Procfile.dev", verbose: false, route: options[:route])
189+
start(:development, "Procfile.dev", verbose: options[:verbose], route: options[:route])
184190
else
185191
puts "Unknown argument: #{command}"
186192
puts "Run 'dev help' for usage information"
187193
exit 1
188194
end
189195
end
196+
# rubocop:enable Metrics/AbcSize
190197

191198
private
192199

0 commit comments

Comments
 (0)