mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
+18
-9
@@ -7,7 +7,7 @@
|
||||
#include "modules/disk/disk.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_DISK_NUM_FORMAT_ARGS 12
|
||||
#define FF_DISK_NUM_FORMAT_ARGS 14
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
||||
static void printDisk(FFDiskOptions* options, const FFDisk* disk)
|
||||
@@ -104,11 +104,16 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY bytesPercentageStr = ffStrbufCreate();
|
||||
ffPercentAppendNum(&bytesPercentageStr, bytesPercentage, options->percent, false, &options->moduleArgs);
|
||||
FF_STRBUF_AUTO_DESTROY filesPercentageStr = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY bytesPercentageNum = ffStrbufCreate();
|
||||
ffPercentAppendNum(&bytesPercentageNum, bytesPercentage, options->percent, false, &options->moduleArgs);
|
||||
FF_STRBUF_AUTO_DESTROY bytesPercentageBar = ffStrbufCreate();
|
||||
ffPercentAppendBar(&bytesPercentageBar, bytesPercentage, options->percent, &options->moduleArgs);
|
||||
|
||||
double filesPercentage = disk->filesTotal > 0 ? ((double) disk->filesUsed / (double) disk->filesTotal) * 100.0 : 0;
|
||||
ffPercentAppendNum(&filesPercentageStr, filesPercentage, options->percent, false, &options->moduleArgs);
|
||||
FF_STRBUF_AUTO_DESTROY filesPercentageNum = ffStrbufCreate();
|
||||
ffPercentAppendNum(&filesPercentageNum, filesPercentage, options->percent, false, &options->moduleArgs);
|
||||
FF_STRBUF_AUTO_DESTROY filesPercentageBar = ffStrbufCreate();
|
||||
ffPercentAppendBar(&filesPercentageBar, filesPercentage, options->percent, &options->moduleArgs);
|
||||
|
||||
bool isExternal = !!(disk->type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT);
|
||||
bool isHidden = !!(disk->type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT);
|
||||
@@ -117,16 +122,18 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
|
||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISK_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "size-used"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "size-total"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageStr, "size-percentage"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageNum, "size-percentage"},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &disk->filesUsed, "files-used"},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &disk->filesTotal, "files-total"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &filesPercentageStr, "files-percentage"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &filesPercentageNum, "files-percentage"},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &isExternal, "is-external"},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &isHidden, "is-hidden"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->filesystem, "filesystem"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->name, "name"},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &isReadOnly, "is-readonly"},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(disk->createTime), "create-time"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageBar, "size-percentage-bar"},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &filesPercentageBar, "files-percentage-bar"},
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -430,16 +437,18 @@ void ffPrintDiskHelpFormat(void)
|
||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DISK_MODULE_NAME, "{1} / {2} ({3}) - {9}", FF_DISK_NUM_FORMAT_ARGS, ((const char* []) {
|
||||
"Size used - size-used",
|
||||
"Size total - size-total",
|
||||
"Size percentage - size-percentage",
|
||||
"Size percentage num - size-percentage",
|
||||
"Files used - files-used",
|
||||
"Files total - files-total",
|
||||
"Files percentage - files-percentage",
|
||||
"Files percentage num - files-percentage",
|
||||
"True if external volume - is-external",
|
||||
"True if hidden volume - is-hidden",
|
||||
"Filesystem - filesystem",
|
||||
"Label / name - name",
|
||||
"True if read-only - is-readonly",
|
||||
"Create time in local timezone - create-time",
|
||||
"Size percentage bar - size-percentage-bar",
|
||||
"Files percentage bar - files-percentage-bar",
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user