mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-28 15:53:51 +01:00
@@ -179,6 +179,12 @@ void ffPrintDisk(FFDiskOptions* options)
|
||||
if(__builtin_expect(options->folders.length == 0, 1) && (disk->type & ~options->showTypes))
|
||||
continue;
|
||||
|
||||
if (options->hideFolders.length && ffDiskMatchMountpoint(&options->hideFolders, disk->mountpoint.chars))
|
||||
continue;
|
||||
|
||||
if (options->hideFS.length && ffStrbufMatchSeparated(&disk->filesystem, &options->hideFS, ':'))
|
||||
continue;
|
||||
|
||||
printDisk(options, disk, ++index);
|
||||
}
|
||||
}
|
||||
@@ -211,6 +217,12 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "hide-fs"))
|
||||
{
|
||||
ffOptionParseString(key, value, &options->hideFS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "show-regular"))
|
||||
{
|
||||
if (ffOptionParseBoolean(value))
|
||||
@@ -305,6 +317,12 @@ void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "hideFS"))
|
||||
{
|
||||
ffStrbufSetS(&options->hideFS, yyjson_get_str(val));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showExternal"))
|
||||
{
|
||||
if (yyjson_get_bool(val))
|
||||
@@ -397,6 +415,9 @@ void ffGenerateDiskJsonConfig(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
|
||||
if (!ffStrbufEqual(&options->hideFolders, &defaultOptions.hideFolders))
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "hideFolders", &options->hideFolders);
|
||||
|
||||
if (!ffStrbufEqual(&options->hideFS, &defaultOptions.hideFS))
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "hideFS", &options->hideFS);
|
||||
|
||||
if (defaultOptions.calcType != options->calcType)
|
||||
yyjson_mut_obj_add_bool(doc, module, "useAvailable", options->calcType == FF_DISK_CALC_TYPE_AVAILABLE);
|
||||
|
||||
@@ -516,6 +537,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
|
||||
#else
|
||||
ffStrbufInitStatic(&options->hideFolders, "/efi:/boot:/boot/efi");
|
||||
#endif
|
||||
ffStrbufInit(&options->hideFS);
|
||||
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT | FF_DISK_VOLUME_TYPE_READONLY_BIT;
|
||||
options->calcType = FF_DISK_CALC_TYPE_FREE;
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
@@ -524,4 +546,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
|
||||
void ffDestroyDiskOptions(FFDiskOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
ffStrbufDestroy(&options->folders);
|
||||
ffStrbufDestroy(&options->hideFolders);
|
||||
ffStrbufDestroy(&options->hideFS);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ typedef struct FFDiskOptions
|
||||
|
||||
FFstrbuf folders;
|
||||
FFstrbuf hideFolders;
|
||||
FFstrbuf hideFS;
|
||||
FFDiskVolumeType showTypes;
|
||||
FFDiskCalcType calcType;
|
||||
FFPercentageModuleConfig percent;
|
||||
|
||||
Reference in New Issue
Block a user