mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
+20
-1
@@ -166,7 +166,7 @@ static void printAutodetected(FFDiskOptions* options, const FFlist* disks)
|
||||
void ffPrintDisk(FFDiskOptions* options)
|
||||
{
|
||||
FF_LIST_AUTO_DESTROY disks = ffListCreate(sizeof (FFDisk));
|
||||
const char* error = ffDetectDisks(&disks);
|
||||
const char* error = ffDetectDisks(options, &disks);
|
||||
|
||||
if(error)
|
||||
{
|
||||
@@ -195,6 +195,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
|
||||
|
||||
ffStrbufInit(&options->folders);
|
||||
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
|
||||
options->calcType = FF_DISK_CALC_TYPE_FREE;
|
||||
}
|
||||
|
||||
bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const char* value)
|
||||
@@ -255,6 +256,15 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "use-available"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
options->calcType = FF_DISK_CALC_TYPE_AVAILABLE;
|
||||
else
|
||||
options->calcType = FF_DISK_CALC_TYPE_FREE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -318,6 +328,15 @@ void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "useAvailable"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
options->calcType = FF_DISK_CALC_TYPE_AVAILABLE;
|
||||
else
|
||||
options->calcType = FF_DISK_CALC_TYPE_FREE;
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_DISK_MODULE_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,12 @@ typedef enum FFDiskVolumeType
|
||||
FF_DISK_VOLUME_TYPE_UNKNOWN_BIT = 1 << 4,
|
||||
} FFDiskVolumeType;
|
||||
|
||||
typedef enum FFDiskCalcType
|
||||
{
|
||||
FF_DISK_CALC_TYPE_FREE,
|
||||
FF_DISK_CALC_TYPE_AVAILABLE,
|
||||
} FFDiskCalcType;
|
||||
|
||||
typedef struct FFDiskOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
@@ -21,4 +27,5 @@ typedef struct FFDiskOptions
|
||||
|
||||
FFstrbuf folders;
|
||||
FFDiskVolumeType showTypes;
|
||||
FFDiskCalcType calcType;
|
||||
} FFDiskOptions;
|
||||
|
||||
Reference in New Issue
Block a user