clean the color code from the text

This commit is contained in:
defnax 2023-10-29 18:24:25 +01:00
parent 36282e750d
commit ab7deede57

View File

@ -60,7 +60,7 @@ public:
bool /*prev_is_bad*/, std::string& password, bool& cancel )
{
std::string question1 = title +
"\033[0;32mPlease enter your PGP password for key:\n \033[0m" +
"\033[0;32m" "Please enter your PGP password for key:\n " "\033[0m" +
question + " :";
password = RsUtil::rs_getpass(question1.c_str()) ;
cancel = false ;
@ -182,18 +182,18 @@ int main(int argc, char* argv[])
while(keepRunning)
{
webui_pass1 = RsUtil::rs_getpass(
"\033[0;32mPlease register a password for the web interface:\033[0m" );
"\033[0;32m" "Please register a password for the web interface:" "\033[0m" );
webui_pass2 = RsUtil::rs_getpass(
"\033[0;32mPlease enter the same password again :\033[0m" );
"\033[0;32m" "Please enter the same password again :" "\033[0m" );
if(webui_pass1 != webui_pass2)
{
std::cout << "\033[1;31mPasswords do not match!\033[0m" << std::endl;
std::cout << "\033[1;31m" "Passwords do not match!" "\033[0m" << std::endl;
continue;
}
if(webui_pass1.empty())
{
std::cout << "\033[1;31mPassword cannot be empty!\033[0m" << std::endl;
std::cout << "\033[1;31m" "Password cannot be empty!" "\033[0m" << std::endl;
continue;
}
@ -223,28 +223,28 @@ int main(int argc, char* argv[])
if(locations.size() == 0)
{
RsErr() << "\033[1;31mNo available accounts. You cannot use option -U list\033[0m" << std::endl;
RsErr() << "\033[1;31m" "No available accounts. You cannot use option -U list" "\033[0m" << std::endl;
return -RsInit::ERR_NO_AVAILABLE_ACCOUNT;
}
std::cout << std::endl << std::endl
<< "\033[0;32mAvailable accounts:\033[0m" << std::endl;
<< "\033[0;32m" "Available accounts:" "\033[0m" << std::endl;
int accountCountDigits = static_cast<int>( ceil(log(locations.size())/log(10.0)) );
for( uint32_t i=0; i<locations.size(); ++i )
std::cout << "\033[0;32m[" << std::setw(accountCountDigits)
<< std::setfill('0') << i+1 << "]\033[0m \033[33m"
<< locations[i].mLocationId << "\033[0m \033[0;35m ("
<< locations[i].mPgpId << "): "
std::cout << "\033[0;32m" "[" << std::setw(accountCountDigits)
<< std::setfill('0') << i+1 << "] " "\033[0m" "\033[33m"
<< locations[i].mLocationId << "\033[0m" "\033[0;36m" " ("
<< locations[i].mPgpId << "): " "\033[0m" "\033[0;35m"
<< locations[i].mPgpName
<< " (" << locations[i].mLocationName << ")\033[0m"
<< " (" << locations[i].mLocationName << ")" "\033[0m"
<< std::endl;
uint32_t nacc = 0;
while(keepRunning && (nacc < 1 || nacc >= locations.size()))
{
std::cout << "\033[0;32mPlease enter account number:\n\033[0m";
std::cout << "\033[0;32m" "Please enter account number:\n" "\033[0m";
std::cout.flush();
std::string inputStr;
@ -264,7 +264,7 @@ int main(int argc, char* argv[])
RsPeerId ssl_id(prefUserString);
if(ssl_id.isNull())
{
RsErr() << "\033[1;31mInvalid User location id: a hexadecimal ID is expected.\033[0m"
RsErr() << "\033[1;31m" "Invalid User location id: a hexadecimal ID is expected." "\033[0m"
<< std::endl;
return -EINVAL;
}
@ -299,7 +299,7 @@ int main(int argc, char* argv[])
if(RsAccounts::isTorAuto())
{
std::cerr << "\033[0;32(II) Hidden service is ready:\033[0m" << std::endl;
std::cerr << "\033[0;32" "(II) Hidden service is ready:" "\033[0m" << std::endl;
std::string service_id ;
std::string onion_address ;