Global: support --bar-width

This commit is contained in:
李通洲
2023-08-16 16:46:21 +08:00
parent 4b714c7057
commit a0c4f2febd
17 changed files with 84 additions and 43 deletions
+3 -3
View File
@@ -46,7 +46,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
FF_STRBUF_AUTO_DESTROY totalPretty = ffStrbufCreate();
ffParseSize(disk->bytesTotal, &totalPretty);
uint8_t bytesPercentage = disk->bytesTotal > 0 ? (uint8_t) (((long double) disk->bytesUsed / (long double) disk->bytesTotal) * 100.0) : 0;
double bytesPercentage = disk->bytesTotal > 0 ? (double) disk->bytesUsed / (double) disk->bytesTotal * 100.0 : 0;
if(options->moduleArgs.outputFormat.length == 0)
{
@@ -58,7 +58,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
{
if(instance.config.percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
{
ffAppendPercentBar(&str, bytesPercentage, 0, 5, 8);
ffAppendPercentBar(&str, bytesPercentage, 0, 50, 80);
ffStrbufAppendC(&str, ' ');
}
@@ -67,7 +67,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
if(instance.config.percentType & FF_PERCENTAGE_TYPE_NUM_BIT)
{
ffAppendPercentNum(&str, (uint8_t) bytesPercentage, 50, 80, str.length > 0);
ffAppendPercentNum(&str, bytesPercentage, 50, 80, str.length > 0);
ffStrbufAppendC(&str, ' ');
}
}