5252 -z The end-output marker can be omitted, and is assumed at eof.
5353 -v Print the version of cog and exit.
5454 --check Check that the files would not change if run again.
55+ --check-fail-msg='MSG'
56+ If --check fails, include MSG in the output to help devs
57+ understand how to run cog in your project.
5558 --diff With --check, show a diff of what failed the check.
5659 --markers='START END END-OUTPUT'
5760 The patterns surrounding cog inline instructions. Should
@@ -243,6 +246,7 @@ def __init__(self):
243246 self .prologue = ""
244247 self .print_output = False
245248 self .check = False
249+ self .check_fail_msg = None
246250 self .diff = False
247251
248252 def __eq__ (self , other ):
@@ -266,6 +270,7 @@ def parse_args(self, argv):
266270 "cdD:eI:n:o:rs:p:PUvw:xz" ,
267271 [
268272 "check" ,
273+ "check-fail-msg=" ,
269274 "diff" ,
270275 "markers=" ,
271276 "verbosity=" ,
@@ -313,6 +318,8 @@ def parse_args(self, argv):
313318 self .eof_can_be_end = True
314319 elif o == "--check" :
315320 self .check = True
321+ elif o == "--check-fail-msg" :
322+ self .check_fail_msg = a
316323 elif o == "--diff" :
317324 self .diff = True
318325 elif o == "--markers" :
@@ -794,7 +801,10 @@ def callable_main(self, argv):
794801 raise CogUsageError ("No files to process" )
795802
796803 if self .check_failed :
797- raise CogCheckFailed ("Check failed" )
804+ msg = "Check failed"
805+ if self .options .check_fail_msg :
806+ msg = f"{ msg } : { self .options .check_fail_msg } "
807+ raise CogCheckFailed (msg )
798808
799809 def main (self , argv ):
800810 """Handle the command-line execution for cog."""
0 commit comments