-
-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from yamadashy/feature/top-files-len
Add --top-files-length option to customize top files display
- Loading branch information
Showing
10 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pc from 'picocolors'; | ||
|
||
export function printSummary(totalFiles: number, totalCharacters: number, outputPath: string) { | ||
console.log(pc.white('📊 Pack Summary:')); | ||
console.log(pc.dim('────────────────')); | ||
console.log(`${pc.white('Total Files:')} ${pc.white(totalFiles.toString())}`); | ||
console.log(`${pc.white('Total Chars:')} ${pc.white(totalCharacters.toString())}`); | ||
console.log(`${pc.white(' Output:')} ${pc.white(outputPath)}`); | ||
} | ||
|
||
export function printTopFiles(fileCharCounts: Record<string, number>, topFilesLength: number) { | ||
console.log(pc.white(`📈 Top ${topFilesLength} Files by Character Count:`)); | ||
console.log(pc.dim('──────────────────────────────────')); | ||
|
||
const topFiles = Object.entries(fileCharCounts) | ||
.sort((a, b) => b[1] - a[1]) | ||
.slice(0, topFilesLength); | ||
|
||
topFiles.forEach(([filePath, count], index) => { | ||
const indexString = `${index + 1}.`.padEnd(3, ' '); | ||
console.log(`${pc.white(`${indexString}`)} ${pc.white(filePath)} ${pc.dim(`(${count} chars)`)}`); | ||
}); | ||
} | ||
|
||
export function printCompletion() { | ||
console.log(pc.green('🎉 All Done!')); | ||
console.log(pc.white('Your repository has been successfully packed.')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters