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