@@ -52,11 +52,11 @@ def add_line_numbers(content):
52
52
return "\n " .join (numbered_lines )
53
53
54
54
55
- def print_path (writer , path , content , cxml , code , line_numbers ):
55
+ def print_path (writer , path , content , cxml , markdown , line_numbers ):
56
56
if cxml :
57
57
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 )
60
60
else :
61
61
print_default (writer , path , content , line_numbers )
62
62
@@ -84,7 +84,7 @@ def print_as_xml(writer, path, content, line_numbers):
84
84
global_index += 1
85
85
86
86
87
- def print_as_code (writer , path , content , line_numbers ):
87
+ def print_as_markdown (writer , path , content , line_numbers ):
88
88
lang = EXT_TO_LANG .get (path .split ("." )[- 1 ], "" )
89
89
# Figure out how many backticks to use
90
90
backticks = "```"
@@ -108,13 +108,13 @@ def process_path(
108
108
ignore_patterns ,
109
109
writer ,
110
110
claude_xml ,
111
- code ,
111
+ markdown ,
112
112
line_numbers = False ,
113
113
):
114
114
if os .path .isfile (path ):
115
115
try :
116
116
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 )
118
118
except UnicodeDecodeError :
119
119
warning_message = f"Warning: Skipping file { path } due to UnicodeDecodeError"
120
120
click .echo (click .style (warning_message , fg = "red" ), err = True )
@@ -158,7 +158,12 @@ def process_path(
158
158
try :
159
159
with open (file_path , "r" ) as f :
160
160
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 ,
162
167
)
163
168
except UnicodeDecodeError :
164
169
warning_message = (
@@ -220,7 +225,9 @@ def read_paths_from_stdin(use_null_separator):
220
225
help = "Output in XML-ish format suitable for Claude's long context window." ,
221
226
)
222
227
@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" ,
224
231
)
225
232
@click .option (
226
233
"line_numbers" ,
@@ -245,7 +252,7 @@ def cli(
245
252
ignore_patterns ,
246
253
output_file ,
247
254
claude_xml ,
248
- code ,
255
+ markdown ,
249
256
line_numbers ,
250
257
null ,
251
258
):
@@ -275,7 +282,7 @@ def cli(
275
282
...
276
283
</documents>
277
284
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:
279
286
280
287
\b
281
288
path/to/file1.py
@@ -316,7 +323,7 @@ def cli(
316
323
ignore_patterns ,
317
324
writer ,
318
325
claude_xml ,
319
- code ,
326
+ markdown ,
320
327
line_numbers ,
321
328
)
322
329
if claude_xml :
0 commit comments