25 lines
411 B
C++
25 lines
411 B
C++
#include "Entry.h"
|
|
|
|
#include <sstream>
|
|
#include <iostream>
|
|
|
|
std::string
|
|
format_entry( const Entry &entry, const std::size_t widest )
|
|
{
|
|
std::ostringstream oss;
|
|
oss << "[";
|
|
|
|
if( entry.is_dir )
|
|
{
|
|
oss << "1;35;95";
|
|
}
|
|
else if( entry.is_exe )
|
|
{
|
|
oss << "1;36;96";
|
|
}
|
|
oss << 'm' << std::setw( widest + C::filePadding ) << std::setfill( ' ' ) << std::left << entry.name;
|
|
|
|
return std::move( oss ).str();
|
|
}
|
|
|