@@ -52,11 +52,11 @@ def add_line_numbers(content):
5252 return "\n " .join (numbered_lines )
5353
5454
55- def print_path (writer , path , content , cxml , code , line_numbers ):
55+ def print_path (writer , path , content , cxml , markdown , line_numbers ):
5656 if cxml :
5757 print_as_xml (writer , path , content , line_numbers )
58- elif code :
59- print_as_code (writer , path , content , line_numbers )
58+ elif markdown :
59+ print_as_markdown (writer , path , content , line_numbers )
6060 else :
6161 print_default (writer , path , content , line_numbers )
6262
@@ -84,7 +84,7 @@ def print_as_xml(writer, path, content, line_numbers):
8484 global_index += 1
8585
8686
87- def print_as_code (writer , path , content , line_numbers ):
87+ def print_as_markdown (writer , path , content , line_numbers ):
8888 lang = EXT_TO_LANG .get (path .split ("." )[- 1 ], "" )
8989 # Figure out how many backticks to use
9090 backticks = "```"
@@ -108,13 +108,13 @@ def process_path(
108108 ignore_patterns ,
109109 writer ,
110110 claude_xml ,
111- code ,
111+ markdown ,
112112 line_numbers = False ,
113113):
114114 if os .path .isfile (path ):
115115 try :
116116 with open (path , "r" ) as f :
117- print_path (writer , path , f .read (), claude_xml , code , line_numbers )
117+ print_path (writer , path , f .read (), claude_xml , markdown , line_numbers )
118118 except UnicodeDecodeError :
119119 warning_message = f"Warning: Skipping file { path } due to UnicodeDecodeError"
120120 click .echo (click .style (warning_message , fg = "red" ), err = True )
@@ -158,7 +158,12 @@ def process_path(
158158 try :
159159 with open (file_path , "r" ) as f :
160160 print_path (
161- writer , file_path , f .read (), claude_xml , code , line_numbers
161+ writer ,
162+ file_path ,
163+ f .read (),
164+ claude_xml ,
165+ markdown ,
166+ line_numbers ,
162167 )
163168 except UnicodeDecodeError :
164169 warning_message = (
@@ -220,7 +225,9 @@ def read_paths_from_stdin(use_null_separator):
220225 help = "Output in XML-ish format suitable for Claude's long context window." ,
221226)
222227@click .option (
223- "--code" , is_flag = True , help = "Output in triple backtick fenced code blocks"
228+ "--markdown" ,
229+ is_flag = True ,
230+ help = "Output Markdown with fenced code blocks" ,
224231)
225232@click .option (
226233 "line_numbers" ,
@@ -245,7 +252,7 @@ def cli(
245252 ignore_patterns ,
246253 output_file ,
247254 claude_xml ,
248- code ,
255+ markdown ,
249256 line_numbers ,
250257 null ,
251258):
@@ -275,7 +282,7 @@ def cli(
275282 ...
276283 </documents>
277284
278- If the `--code ` flag is provided, the output will be structured as follows:
285+ If the `--markdown ` flag is provided, the output will be structured as follows:
279286
280287 \b
281288 path/to/file1.py
@@ -316,7 +323,7 @@ def cli(
316323 ignore_patterns ,
317324 writer ,
318325 claude_xml ,
319- code ,
326+ markdown ,
320327 line_numbers ,
321328 )
322329 if claude_xml :
0 commit comments