Modules: adds * to format args which are available in key format

This commit is contained in:
李通洲
2026-09-15 22:20:17 +08:00
parent 53e868667a
commit 02dc6a4428
18 changed files with 33 additions and 30 deletions
+1
View File
@@ -70,6 +70,7 @@ static void printCommandFormatHelp(const char* command) {
printf("-- In config file: { \"type\": \"%s\", \"format\": \"{<format-variable>}\" }\n", type.chars);
printf("Sets the format string for %s output.\n", baseInfo->name);
puts("To see how a format string is constructed, take a look at https://github.com/fastfetch-cli/fastfetch/wiki/Format-String-Guide.");
puts("Descriptions which end with a '*' are available in key format too.");
puts("The following variables are passed:");
uint32_t maxWidth = 20;
+2 -2
View File
@@ -147,7 +147,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
FF_ARG(result->manufacturer, "manufacturer"),
FF_ARG(result->modelName, "model-name"),
FF_ARG(result->modelName, "name"),
FF_ARG(result->technology, "technology"),
FF_ARG(capacityNum, "capacity"),
FF_ARG(status, "status"),
@@ -330,7 +330,7 @@ FFModuleBaseInfo ffBatteryModuleInfo = {
.generateJsonConfig = (void*) ffGenerateBatteryJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Battery manufacturer", "manufacturer" },
{ "Battery model name", "model-name" },
{ "Battery model name *", "name" },
{ "Battery technology", "technology" },
{ "Battery capacity (percentage num)", "capacity" },
{ "Battery status", "status" },
+2 -2
View File
@@ -161,12 +161,12 @@ FFModuleBaseInfo ffBiosModuleInfo = {
.printModule = (void*) ffPrintBios,
.generateJsonResult = (void*) ffGenerateBiosJsonResult,
.generateJsonConfig = (void*) ffGenerateBiosJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]){
{ "BIOS date", "date" },
{ "BIOS release", "release" },
{ "BIOS vendor", "vendor" },
{ "BIOS version", "version" },
{ "Firmware type", "type" },
{ "Firmware type *", "type" },
})),
.defaultOrder = 5,
};
+1 -1
View File
@@ -220,7 +220,7 @@ FFModuleBaseInfo ffBluetoothRadioModuleInfo = {
.generateJsonResult = (void*) ffGenerateBluetoothRadioJsonResult,
.generateJsonConfig = (void*) ffGenerateBluetoothRadioJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Radio name for discovering", "name" },
{ "Radio name for discovering *", "name" },
{ "Address", "address" },
{ "LMP version", "lmp-version" },
{ "LMP subversion", "lmp-subversion" },
+1 -1
View File
@@ -223,7 +223,7 @@ FFModuleBaseInfo ffBrightnessModuleInfo = {
.generateJsonConfig = (void*) ffGenerateBrightnessJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Screen brightness (percentage num)", "percentage" },
{ "Screen name", "name" },
{ "Screen name *", "name" },
{ "Maximum brightness value", "max" },
{ "Minimum brightness value", "min" },
{ "Current brightness value", "current" },
+1 -1
View File
@@ -230,7 +230,7 @@ FFModuleBaseInfo ffBtrfsModuleInfo = {
.generateJsonResult = (void*) ffGenerateBtrfsJsonResult,
.generateJsonConfig = (void*) ffGenerateBtrfsJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Name / Label", "name" },
{ "Name / Label *", "name" },
{ "UUID", "uuid" },
{ "Associated devices", "devices" },
{ "Enabled features", "features" },
+2 -2
View File
@@ -283,8 +283,8 @@ FFModuleBaseInfo ffCodecModuleInfo = {
.generateJsonResult = (void*) ffGenerateCodecJsonResult,
.generateJsonConfig = (void*) ffGenerateCodecJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]){
{ "GPU name", "gpu" },
{ "Decoder / Encoder", "direction" },
{ "GPU name *", "gpu" },
{ "Decoder / Encoder *", "direction" },
{ "Compatibility alias of codec types", "types" },
{ "Platform API used for detection", "platform-api" },
})),
+2
View File
@@ -65,6 +65,7 @@ static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOption
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
FF_ARG(buffer, "result"),
FF_ARG(buffer2, "sum"),
FF_ARG(levelStr, "level"),
}));
}
}
@@ -255,6 +256,7 @@ FFModuleBaseInfo ffCPUCacheModuleInfo = {
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Separate result", "result" },
{ "Sum result", "sum" },
{ "Cache level *", "level" },
})),
.defaultOrder = 34,
};
+4 -4
View File
@@ -491,8 +491,8 @@ FFModuleBaseInfo ffDiskModuleInfo = {
{ "Files percentage num", "files-percentage" },
{ "True if external volume", "is-external" },
{ "True if hidden volume", "is-hidden" },
{ "Filesystem", "filesystem" },
{ "Label / name", "name" },
{ "Filesystem *", "filesystem" },
{ "Label / name *", "name" },
{ "True if read-only", "is-readonly" },
{ "Create time in local timezone", "create-time" },
{ "Size percentage bar", "size-percentage-bar" },
@@ -502,8 +502,8 @@ FFModuleBaseInfo ffDiskModuleInfo = {
{ "Minutes after creation", "minutes" },
{ "Seconds after creation", "seconds" },
{ "Milliseconds after creation", "milliseconds" },
{ "Mount point / drive letter", "mountpoint" },
{ "Mount from (device path)", "mount-from" },
{ "Mount point / drive letter *", "mountpoint" },
{ "Mount from (device path) *", "mount-from" },
{ "Years integer after creation", "years" },
{ "Days of year after creation", "days-of-year" },
{ "Years fraction after creation", "years-fraction" },
+3 -3
View File
@@ -205,10 +205,10 @@ FFModuleBaseInfo ffDiskIOModuleInfo = {
.generateJsonResult = (void*) ffGenerateDiskIOJsonResult,
.generateJsonConfig = (void*) ffGenerateDiskIOJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Size of data read [per second] (formatted)", "size-read" },
{ "Size of data read [per second] (formatted)" , "size-read" },
{ "Size of data written [per second] (formatted)", "size-written" },
{ "Device name", "name" },
{ "Device raw file path", "dev-path" },
{ "Device name *", "name" },
{ "Device raw file path *", "dev-path" },
{ "Size of data read [per second] (in bytes)", "bytes-read" },
{ "Size of data written [per second] (in bytes)", "bytes-written" },
{ "Number of reads", "read-count" },
+2 -2
View File
@@ -448,8 +448,8 @@ FFModuleBaseInfo ffDisplayModuleInfo = {
{ "Screen configured refresh rate (in Hz)", "refresh-rate" },
{ "Screen scaled width (in pixels)", "scaled-width" },
{ "Screen scaled height (in pixels)", "scaled-height" },
{ "Screen name", "name" },
{ "Screen type (Built-in or External)", "type" },
{ "Screen name *", "name" },
{ "Screen type (Built-in or External) *", "type" },
{ "Screen rotation (in degrees)", "rotation" },
{ "True if being the primary screen", "is-primary" },
{ "Screen physical width (in millimeters)", "physical-width" },
+2 -2
View File
@@ -455,8 +455,8 @@ FFModuleBaseInfo ffLocalIPModuleInfo = {
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "IPv4 address", "ipv4" },
{ "IPv6 address", "ipv6" },
{ "MAC address", "mac" },
{ "Interface name", "ifname" },
{ "MAC address *", "mac" },
{ "Interface name *", "ifname" },
{ "Is default route", "is-default-route" },
{ "MTU size in bytes", "mtu" },
{ "Link speed (formatted)", "speed" },
+1 -1
View File
@@ -136,7 +136,7 @@ FFModuleBaseInfo ffMonitorModuleInfo = {
.generateJsonResult = (void*) ffGenerateMonitorJsonResult,
.generateJsonConfig = (void*) ffGenerateMonitorJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Display name", "name" },
{ "Display name *", "name" },
{ "Native resolution width in pixels", "width" },
{ "Native resolution height in pixels", "height" },
{ "Physical width in millimeters", "physical-width" },
+2 -2
View File
@@ -20,7 +20,7 @@ static void formatKey(const FFNetIOOptions* options, FFNetIOResult* inf, uint32_
ffStrbufClear(key);
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, ((FFformatarg[]) {
FF_ARG(index, "index"),
FF_ARG(inf->name, "name"),
FF_ARG(inf->name, "ifname"),
FF_ARG(options->moduleArgs.keyIcon, "icon"),
FF_ARG(FF_MODULE_GET_DISPLAY_NAME(NetIO), "module-name"),
}));
@@ -234,7 +234,7 @@ FFModuleBaseInfo ffNetIOModuleInfo = {
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Size of data received [per second] (formatted)", "rx-size" },
{ "Size of data sent [per second] (formatted)", "tx-size" },
{ "Interface name", "ifname" },
{ "Interface name *", "ifname" },
{ "Is default route", "is-default-route" },
{ "Size of data received [per second] (in bytes)", "rx-bytes" },
{ "Size of data sent [per second] (in bytes)", "tx-bytes" },
+2 -2
View File
@@ -204,8 +204,8 @@ FFModuleBaseInfo ffOSModuleInfo = {
.generateJsonResult = (void*) ffGenerateOSJsonResult,
.generateJsonConfig = (void*) ffGenerateOSJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Name of the kernel", "sysname" },
{ "Name of the OS", "name" },
{ "Name of the kernel *", "sysname" },
{ "Name of the OS *", "name" },
{ "Pretty name of the OS, if available", "pretty-name" },
{ "ID of the OS", "id" },
{ "ID like of the OS", "id-like" },
+2 -2
View File
@@ -296,9 +296,9 @@ FFModuleBaseInfo ffPhysicalDiskModuleInfo = {
.generateJsonConfig = (void*) ffGeneratePhysicalDiskJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Device size (formatted)", "size" },
{ "Device name", "name" },
{ "Device name *", "name" },
{ "Device interconnect type", "interconnect" },
{ "Device raw file path", "dev-path" },
{ "Device raw file path *", "dev-path" },
{ "Serial number", "serial" },
{ "Device kind (SSD or HDD)", "physical-type" },
{ "Device kind (Removable or Fixed)", "removable-type" },
+1 -1
View File
@@ -218,7 +218,7 @@ FFModuleBaseInfo ffSwapModuleInfo = {
{ "Total size", "total" },
{ "Percentage used (num)", "percentage" },
{ "Percentage used (bar)", "percentage-bar" },
{ "Name", "name" },
{ "Name *", "name" },
})),
.defaultOrder = 40,
};
+2 -2
View File
@@ -224,8 +224,8 @@ FFModuleBaseInfo ffZpoolModuleInfo = {
.generateJsonResult = (void*) ffGenerateZpoolJsonResult,
.generateJsonConfig = (void*) ffGenerateZpoolJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{ "Zpool name", "name" },
{ "Zpool guid", "guid" },
{ "Zpool name *", "name" },
{ "Zpool guid *", "guid" },
{ "Zpool state", "state" },
{ "Size used", "size-used" },
{ "Size allocated", "size-allocated" },