* add padding for sticky-left languages
* fix bar lenght by adding floor and ceil
This commit is contained in:
parent
09120af3ba
commit
c6120bf8b4
1 changed files with 4 additions and 3 deletions
|
@ -146,9 +146,9 @@ async (locales: Map<string, Map<string, string>>, default_lang: string) => {
|
||||||
locales_size.forEach((size, lang) => {
|
locales_size.forEach((size, lang) => {
|
||||||
const percentage = (size / max_size) * 100;
|
const percentage = (size / max_size) * 100;
|
||||||
// Colored bar part
|
// Colored bar part
|
||||||
const blocks = ' '.repeat(percentage / bar_size);
|
const blocks = ' '.repeat(Math.floor(percentage / bar_size));
|
||||||
// Blank bar part
|
// Blank bar part
|
||||||
const blank = ' '.repeat((100 - percentage) / bar_size);
|
const blank = ' '.repeat(Math.ceil((100 - percentage) / bar_size));
|
||||||
const color = () => {
|
const color = () => {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case percentage <= 25:
|
case percentage <= 25:
|
||||||
|
@ -167,7 +167,8 @@ async (locales: Map<string, Map<string, string>>, default_lang: string) => {
|
||||||
return '';
|
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)}%`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue