Commit 972e283 1 parent a342d02 commit 972e283 Copy full SHA for 972e283
File tree 2 files changed +11
-6
lines changed
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ <h1 class="text-3xl font-bold mb-2 text-center text-gray-600">GitHub to Plain Te
70
70
< i data-lucide ="file-text " class ="w-5 h-5 mr-2 "> </ i >
71
71
Generate Text File
72
72
</ button >
73
- < textarea id ="outputText " rows ="20 " class ="mt-4 w-full p-2 border rounded-md " readonly > </ textarea >
73
+ < textarea id ="outputText " rows ="20 " class ="mt-4 w-full p-2 border rounded-md font-mono " readonly > </ textarea >
74
74
< div class ="mt-4 flex space-x-4 ">
75
75
< button id ="copyButton " class ="flex-1 bg-indigo-500 hover:bg-indigo-600 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline hidden flex items-center justify-center ">
76
76
< i data-lucide ="copy " class ="w-5 h-5 mr-2 "> </ i >
Original file line number Diff line number Diff line change @@ -286,12 +286,17 @@ function formatRepoContents(contents) {
286
286
// Function to recursively build the index
287
287
function buildIndex ( node , prefix = '' ) {
288
288
let result = '' ;
289
- for ( const [ name , subNode ] of Object . entries ( node ) ) {
290
- result += `${ prefix } ${ name } \n` ;
289
+ const entries = Object . entries ( node ) ;
290
+ entries . forEach ( ( [ name , subNode ] , index ) => {
291
+ const isLastItem = index === entries . length - 1 ;
292
+ const linePrefix = isLastItem ? '└── ' : '├── ' ;
293
+ const childPrefix = isLastItem ? ' ' : '│ ' ;
294
+
295
+ result += `${ prefix } ${ linePrefix } ${ name } \n` ;
291
296
if ( subNode ) {
292
- result += buildIndex ( subNode , `${ prefix } ` ) ;
297
+ result += buildIndex ( subNode , `${ prefix } ${ childPrefix } ` ) ;
293
298
}
294
- }
299
+ } ) ;
295
300
return result ;
296
301
}
297
302
@@ -301,7 +306,7 @@ function formatRepoContents(contents) {
301
306
text += `\n\n---\nFile: ${ item . path } \n---\n\n${ item . text } \n` ;
302
307
} ) ;
303
308
304
- return `--------------------\nDirectory Structure:\n--------------------\n\n ${ index } ${ text } ` ;
309
+ return `Directory Structure:\n\n ${ index } \n ${ text } ` ;
305
310
}
306
311
307
312
function sortContents ( contents ) {
You can’t perform that action at this time.
0 commit comments