@@ -238,12 +238,14 @@ class CLI < Thor
238238 class_option :fail_on_diff , type : :boolean , desc : "Fail if there are differences"
239239 class_option :commit , type : :string , desc : "Compare against a specific commit"
240240 class_option :new_app_options , type : :string , desc : "Options to pass to the rails new command"
241+ class_option :debug , type : :boolean , desc : "Print debug information" , aliases : [ "-d" ]
241242
242243 def self . exit_on_failure? = true
243244
244245 desc "file FILE [FILE ...]" , "Compare one or more files from your repository with Rails' generated version"
245246 def file ( *files )
246247 abort "Please provide at least one file to compare" if files . empty?
248+ ENV [ "DEBUG" ] = "true" if options [ :debug ]
247249
248250 diff = Rails ::Diff . file ( *files , no_cache : options [ :no_cache ] , commit : options [ :commit ] , new_app_options : options [ :new_app_options ] )
249251 return if diff . empty?
@@ -254,6 +256,7 @@ def file(*files)
254256 desc "generated GENERATOR [args]" , "Compare files that would be created by a Rails generator"
255257 option :skip , type : :array , desc : "Skip specific files or directories" , aliases : [ "-s" ] , default : [ ]
256258 def generated ( generator_name , *args )
259+ ENV [ "DEBUG" ] = "true" if options [ :debug ]
257260 diff = Rails ::Diff . generated ( generator_name , *args , no_cache : options [ :no_cache ] , skip : options [ :skip ] , commit : options [ :commit ] , new_app_options : options [ :new_app_options ] )
258261 return if diff . empty?
259262
0 commit comments