diff --git a/Lang/pt-br.json b/Lang/pt-br.json index c15f34c..6735e8f 100644 --- a/Lang/pt-br.json +++ b/Lang/pt-br.json @@ -153,12 +153,12 @@ "batchStatus": "==> Atualização global:", "batch_overallProgress": "Progresso geral: %VAR_0%% [%VAR_1% de %VAR_2%]", - "batch_updateCounter": "Atualizações: %VAR_0%%VAR_1%%VAR_2%", - "batch_errorCounter": "Erros: %VAR_0%%VAR_1%%VAR_2%", + "batch_updateCounter": "Atualizações: %VAR_0%", + "batch_errorCounter": "Erros: %VAR_0%", "batch_elapsedTime": "Tempo decorrido: %VAR_0%%VAR_1%%VAR_2%", "batchProcessList": "==> Processos ativos:", - "batchProcess": "%VAR_0% %VAR_1% Processo %VAR_2% - Progresso: %VAR_3%% [%VAR_4% de %VAR_5%] - Atualizações: %VAR_6%%VAR_7%%VAR_8%, Erros: %VAR_9%%VAR_10%%VAR_11%%VAR_12%", + "batchProcess": "%VAR_0% %VAR_1% Processo %VAR_2% - Progresso: %VAR_3%% [%VAR_4% de %VAR_5%] - Atualizações: %VAR_6%, Erros: %VAR_7%%VAR_8%", "noErrorsRun": "...Nenhum erro ocorreu durante todo o processo.", "noUpdatesRun": "...Nenhum repositório foi atualizado durante todo o processo.", diff --git a/src/lang.ts b/src/lang.ts index bf5c4bc..709a1f0 100644 --- a/src/lang.ts +++ b/src/lang.ts @@ -179,12 +179,12 @@ export var langDatabase:any = { "batchStatus": "==> Batch update:", "batch_overallProgress": "Overall Progress: %VAR_0%% [%VAR_1% of %VAR_2%]", - "batch_updateCounter": "Update counter: %VAR_0%%VAR_1%%VAR_2%", - "batch_errorCounter": "Error counter: %VAR_0%%VAR_1%%VAR_2%", + "batch_updateCounter": "Update counter: %VAR_0%", + "batch_errorCounter": "Error counter: %VAR_0%", "batch_elapsedTime": "Elapsed time: %VAR_0%%VAR_1%%VAR_2%", "batchProcessList": "==> Process list:", - "batchProcess": "%VAR_0% %VAR_1% Process %VAR_2% - Progress: %VAR_3%% [%VAR_4% of %VAR_5%] - Repos updated: %VAR_6%%VAR_7%%VAR_8%, Errors: %VAR_9%%VAR_10%%VAR_11%%VAR_12%", + "batchProcess": "%VAR_0% %VAR_1% Process %VAR_2% - Progress: %VAR_3%% [%VAR_4% of %VAR_5%] - Repos updated: %VAR_6%, Errors: %VAR_7%%VAR_8%", "noErrorsRun": "...there was no errors on this run.", "noUpdatesRun": "...there was no updates on this run.", diff --git a/src/tools.ts b/src/tools.ts index 49855e5..cbb1a65 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -54,12 +54,60 @@ export const runExternalCommand_Defaults:Pick 0) res = `${newColor}${currentValue}${consoleTextStyle.reset}`; + return res; +} + /** * Update console line * @param x [number] Console X position diff --git a/src/update.ts b/src/update.ts index 5555a53..5b79ea8 100644 --- a/src/update.ts +++ b/src/update.ts @@ -10,11 +10,10 @@ */ import { grppRepoEntry } from './import'; -import { grpp_displayMainLogo } from './utils'; import { grpp_convertLangVar, langDatabase } from './lang'; -import { consoleTextStyle, grpp_getLogoString } from './utils'; +import { grpp_displayMainLogo, grpp_getLogoString } from './utils'; import { APP_COMPILED_AT, APP_HASH, APP_VERSION, grpp_updateRepoData, grpp_updateDatabaseSettings, grppSettings } from './main'; -import { checkConnection, converMsToHHMMSS, convertArrayToString, createLogEntry, execReasonListCheck, isValidJSON, openOnTextEditor, parsePercentage, parsePositive, runExternalCommand, runExternalCommand_Defaults, runExternalCommand_output, spliceArrayIntoChunks, trimString, updateConsoleLine } from './tools'; +import { checkConnection, converMsToHHMMSS, convertArrayToString, createLogEntry, execReasonListCheck, isValidJSON, openOnTextEditor, parsePercentage, parsePositive, runExternalCommand, runExternalCommand_Defaults, runExternalCommand_output, spliceArrayIntoChunks, trimString, updateConsoleLine, consoleTextStyle, changeTextColorNumber } from './tools'; /* Require node modules @@ -343,16 +342,16 @@ function processBatchResFiles(){ entryChar = ' └'; enableLineBreak = '\n'; updateConsoleLine(0, 11, `──┬ ${grpp_convertLangVar(langDatabase.update.batch_overallProgress, [parsePercentage(reposProcessed, totalReposQueued), reposProcessed, totalReposQueued])}`); - updateConsoleLine(0, 13, ` ├ ${grpp_convertLangVar(langDatabase.update.batch_updateCounter, [consoleTextStyle.fgGreen, updateCounter, consoleTextStyle.reset])}`); - updateConsoleLine(0, 14, ` └ ${grpp_convertLangVar(langDatabase.update.batch_errorCounter, [consoleTextStyle.fgRed, errorCounter, consoleTextStyle.reset])}\n\n${langDatabase.update.batchProcessList}\n\n`); + updateConsoleLine(0, 13, ` ├ ${grpp_convertLangVar(langDatabase.update.batch_updateCounter, [changeTextColorNumber(updateCounter, consoleTextStyle.fgGreen)])}`); + updateConsoleLine(0, 14, ` └ ${grpp_convertLangVar(langDatabase.update.batch_errorCounter, [changeTextColorNumber(errorCounter, consoleTextStyle.fgGreen)])}\n\n${langDatabase.update.batchProcessList}\n\n`); } // Update entryChar if there is only one process and update elapsed time line - if (totalResFiles === 1) entryChar = '───'; + if (totalResFiles === 1) entryChar = '-->'; updateConsoleLine(0, 12, ` ├ ${grpp_convertLangVar(langDatabase.update.batch_elapsedTime, [consoleTextStyle.fgGreen, converMsToHHMMSS(parsePositive(performance.now() - startUpdateTime)), consoleTextStyle.reset])}`); - // Check if process finished. If so, update checkbox char and update each process line - if (batchResData.currentRepo > (batchResData.totalRepos - 1)) checkboxChar = '[✓]'; + // Check if process finished - if so, update checkbox char and update each process line + if (batchResData.currentRepo > (batchResData.totalRepos - 1)) checkboxChar = `[${consoleTextStyle.fgGreen}✓${consoleTextStyle.reset}]`; updateConsoleLine(0, (currentFile + 18), grpp_convertLangVar(langDatabase.update.batchProcess, [ entryChar, checkboxChar, @@ -360,12 +359,8 @@ function processBatchResFiles(){ parsePercentage(batchResData.currentRepo, batchResData.totalRepos), batchResData.currentRepo, batchResData.totalRepos, - consoleTextStyle.fgGreen, - batchResData.updateList.length, - consoleTextStyle.reset, - consoleTextStyle.fgRed, - batchResData.errorList.length, - consoleTextStyle.reset, + changeTextColorNumber(batchResData.updateList.length, consoleTextStyle.fgGreen), + changeTextColorNumber(batchResData.errorList.length, consoleTextStyle.fgRed), enableLineBreak ])); diff --git a/src/utils.ts b/src/utils.ts index 84066ea..73102f1 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -21,42 +21,6 @@ import { consoleClear, converMsToHHMMSS, convertArrayToString, createLogEntry, e import * as module_fs from 'fs'; import * as module_os from 'os'; -/* - Variables -*/ - -/* - Console text style database - Source code: https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color -*/ -export const consoleTextStyle = { - 'reset': "\x1b[0m", - 'bright': "\x1b[1m", - 'dim': "\x1b[2m", - 'underline': "\x1b[4m", - 'blink': "\x1b[5m", - 'reverse': "\x1b[7m", - 'hidden': "\x1b[8m", - 'fgBlack': "\x1b[30m", - 'fgRed': "\x1b[31m", - 'fgGreen': "\x1b[32m", - 'fgYellow': "\x1b[33m", - 'fgBlue': "\x1b[34m", - 'fgMagenta': "\x1b[35m", - 'fgCyan': "\x1b[36m", - 'fgWhite': "\x1b[37m", - 'fgGray': "\x1b[90m", - 'bgBlack': "\x1b[40m", - 'bgRed': "\x1b[41m", - 'bgGreen': "\x1b[42m", - 'bgYellow': "\x1b[43m", - 'bgBlue': "\x1b[44m", - 'bgMagenta': "\x1b[45m", - 'bgCyan': "\x1b[46m", - 'bgWhite': "\x1b[47m", - 'bgGray': "\x1b[100m" -}; - /* Functions */