Skip to content

Commit 045baa3

Browse files
authored
Update stats.cpp
1 parent c1a285c commit 045baa3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/stats.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "..\header\stats.h"
2+
#include "..\lib\ProgressBar\ProgressBar.h"
23

34
using namespace std;
45
namespace fs = filesystem;
@@ -119,9 +120,14 @@ string determineLanguageForHeader(const fs::path& headerFilePath) {
119120

120121
void LanguageByType(fs::path& directory){
121122
unordered_map<string, LanguageStats> stats;
122-
size_t totalChars = 0;
123-
123+
size_t totalChars = 0, allfile=0, thefile=0;
124+
125+
for (const auto& entry : fs::recursive_directory_iterator(directory))allfile++;
126+
ProgressBar pb(0, int(allfile), '=');
127+
124128
for (const auto& entry : fs::recursive_directory_iterator(directory)) {
129+
pb.setCurrentValue(++thefile);
130+
pb.display();
125131
if (entry.is_regular_file()) {
126132
string extension = entry.path().extension().string();
127133
string filename = entry.path().filename().string();
@@ -150,6 +156,8 @@ void LanguageByType(fs::path& directory){
150156
}
151157
}
152158

159+
std::cout << std::endl;
160+
153161
cout << setw(15) << "Language"
154162
<< setw(15) << "File Count"
155163
<< setw(20) << "Total Characters"

0 commit comments

Comments
 (0)