mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Disk: rename FFDiskType to FFDiskVolumeType
This commit is contained in:
+24
-24
@@ -79,11 +79,11 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
|
||||
if(disk->filesystem.length)
|
||||
ffStrbufAppendF(&str, "- %s ", disk->filesystem.chars);
|
||||
|
||||
if(disk->type & FF_DISK_TYPE_EXTERNAL_BIT)
|
||||
if(disk->type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT)
|
||||
ffStrbufAppendS(&str, "[External]");
|
||||
else if(disk->type & FF_DISK_TYPE_SUBVOLUME_BIT)
|
||||
else if(disk->type & FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT)
|
||||
ffStrbufAppendS(&str, "[Subvolume]");
|
||||
else if(disk->type & FF_DISK_TYPE_HIDDEN_BIT)
|
||||
else if(disk->type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT)
|
||||
ffStrbufAppendS(&str, "[Hidden]");
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
|
||||
double filesPercentage = disk->filesTotal > 0 ? ((double) disk->filesUsed / (double) disk->filesTotal) * 100.0 : 0;
|
||||
ffAppendPercentNum(&filesPercentageStr, filesPercentage, 50, 80, false);
|
||||
|
||||
bool isExternal = !!(disk->type & FF_DISK_TYPE_EXTERNAL_BIT);
|
||||
bool isHidden = !!(disk->type & FF_DISK_TYPE_HIDDEN_BIT);
|
||||
bool isExternal = !!(disk->type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT);
|
||||
bool isHidden = !!(disk->type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT);
|
||||
ffPrintFormatString(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISK_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty},
|
||||
@@ -194,7 +194,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufInit(&options->folders);
|
||||
options->showTypes = FF_DISK_TYPE_REGULAR_BIT | FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
|
||||
}
|
||||
|
||||
bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const char* value)
|
||||
@@ -213,45 +213,45 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
if (ffStrEqualsIgnCase(subKey, "show-regular"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_REGULAR_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_REGULAR_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_REGULAR_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_REGULAR_BIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "show-external"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "show-hidden"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_HIDDEN_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_HIDDEN_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "show-subvolumes"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "show-unknown"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->showTypes |= FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -285,36 +285,36 @@ void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
|
||||
if (ffStrEqualsIgnCase(key, "showExternal"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options->showTypes |= FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_EXTERNAL_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showHidden"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options->showTypes |= FF_DISK_TYPE_HIDDEN_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_HIDDEN_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showSubvolumes"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options->showTypes |= FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_SUBVOLUME_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showUnknown"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options->showTypes |= FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
options->showTypes |= FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
|
||||
else
|
||||
options->showTypes &= ~FF_DISK_TYPE_UNKNOWN_BIT;
|
||||
options->showTypes &= ~FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum FFDiskType
|
||||
typedef enum FFDiskVolumeType
|
||||
{
|
||||
FF_DISK_TYPE_NONE = 0,
|
||||
FF_DISK_TYPE_REGULAR_BIT = 1 << 0,
|
||||
FF_DISK_TYPE_HIDDEN_BIT = 1 << 1,
|
||||
FF_DISK_TYPE_EXTERNAL_BIT = 1 << 2,
|
||||
FF_DISK_TYPE_SUBVOLUME_BIT = 1 << 3,
|
||||
FF_DISK_TYPE_UNKNOWN_BIT = 1 << 4,
|
||||
} FFDiskType;
|
||||
FF_DISK_VOLUME_TYPE_NONE = 0,
|
||||
FF_DISK_VOLUME_TYPE_REGULAR_BIT = 1 << 0,
|
||||
FF_DISK_VOLUME_TYPE_HIDDEN_BIT = 1 << 1,
|
||||
FF_DISK_VOLUME_TYPE_EXTERNAL_BIT = 1 << 2,
|
||||
FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT = 1 << 3,
|
||||
FF_DISK_VOLUME_TYPE_UNKNOWN_BIT = 1 << 4,
|
||||
} FFDiskVolumeType;
|
||||
|
||||
typedef struct FFDiskOptions
|
||||
{
|
||||
@@ -20,5 +20,5 @@ typedef struct FFDiskOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFstrbuf folders;
|
||||
FFDiskType showTypes;
|
||||
FFDiskVolumeType showTypes;
|
||||
} FFDiskOptions;
|
||||
|
||||
Reference in New Issue
Block a user