sophuwu.site > crls
file count and rainbowier
sophuwu sophie@skisiel.com
Sat, 24 Feb 2024 08:49:08 +0100
commit

17096eb51581f82b68392ec9b0e854eb44889274

parent

84d0464eebb5b37edae4615e446337f3b6ee8c2b

2 files changed, 8 insertions(+), 4 deletions(-)

jump to
M rls.cpprls.cpp

@@ -14,13 +14,15 @@

/////// DIRLIST DEFINITIONS /////// ENTLIST DIRLIST::all() { DIRENTS all; + UL f = files.size(); + UL d = dirs.size(); sorter(dirs, all); sorter(files, all); int len = all.size(); if (len < 10) len = 10; else if (len > 50) len = 50; prnt.r.init(len); - return ENTLIST{all}; + return ENTLIST{all, f, d}; } int DIRLIST::charcomp(char a, char b) {

@@ -117,10 +119,9 @@ if (paths.size() == 0) paths.add(".");

} /////// printer DEFINITIONS /////// void printer::operator()() {printf("\n");} - void printer::operator()(std::string str) { if (flags.color) { - r.print2d(str + "\n"); + r.print2d(str + "\n", (300+rand()%200)/10); r.next(); } else printf("%s\n", str.c_str());

@@ -131,6 +132,7 @@ void ENTLIST::print() {

for (DIRENT e : list) { ST{e}; } + if (flags.number) prnt("files: " + std::to_string(files) + " dirs: " + std::to_string(dirs) + " total: " + std::to_string(files+dirs)); } /////// ST DEFINITIONS ///////

@@ -187,7 +189,7 @@ outstr += size() + " ";

if (flags.list) outstr += time() + " "; outstr += e.path().filename().string(); if (e.is_directory()) outstr += "/"; - return outstr; + return " " + outstr; } ST::ST(const DIRENT &e) { prnt(init(e));
M rls.hrls.h

@@ -6,6 +6,8 @@ typedef unsigned long long int UL;

typedef double D; struct ENTLIST{ DIRENTS list; + UL files; + UL dirs; void print(); }; struct DIRLIST {