* add padding for sticky-left languages

* fix bar lenght by adding floor and ceil
This commit is contained in:
Mylloon 2022-07-29 00:52:58 +02:00
parent 09120af3ba
commit c6120bf8b4
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -146,9 +146,9 @@ async (locales: Map<string, Map<string, string>>, default_lang: string) => {
locales_size.forEach((size, lang) => {
const percentage = (size / max_size) * 100;
// Colored bar part
const blocks = ' '.repeat(percentage / bar_size);
const blocks = ' '.repeat(Math.floor(percentage / bar_size));
// Blank bar part
const blank = ' '.repeat((100 - percentage) / bar_size);
const blank = ' '.repeat(Math.ceil((100 - percentage) / bar_size));
const color = () => {
switch (true) {
case percentage <= 25:
@ -167,7 +167,8 @@ async (locales: Map<string, Map<string, string>>, default_lang: string) => {
return '';
}
};
const padding = ' '.repeat(lang.length === 5 ? 1 : 4);
console.log(`${lang} | ${color()}${blocks}\x1b[0m${blank} | ${percentage.toPrecision(3)}%`);
console.log(`${padding}${lang} | ${color()}${blocks}\x1b[0m${blank} | ${percentage.toPrecision(3)}%`);
});
};