Global: support for named format arguments

Fix #796
This commit is contained in:
Carter Li
2024-05-27 16:41:37 +08:00
parent 965777323e
commit c8451cab52
65 changed files with 855 additions and 806 deletions
+75 -50
View File
@@ -52,14 +52,29 @@ void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg)
* @param placeholderValue the string to parse
* @return uint32_t the parsed value
*/
static inline uint32_t getArgumentIndex(const FFstrbuf* placeholderValue)
static uint32_t getArgumentIndex(const FFstrbuf* placeholderValue, uint32_t numArgs, const FFformatarg* arguments)
{
uint32_t result = UINT32_MAX;
char firstChar = placeholderValue->chars[0];
if(placeholderValue->chars[0] != '-')
sscanf(placeholderValue->chars, "%" PRIu32, &result);
if(firstChar >= '1' && firstChar <= '9')
{
char* pEnd = NULL;
unsigned long result = strtoul(placeholderValue->chars, &pEnd, 10);
if (pEnd != placeholderValue->chars + placeholderValue->length || result > numArgs)
return UINT32_MAX;
return (uint32_t) result;
}
else if (ffCharIsEnglishAlphabet(firstChar))
{
for (uint32_t i = 0; i < numArgs; ++i)
{
const FFformatarg* arg = &arguments[i];
if(arg->name && ffStrbufIgnCaseEqualS(placeholderValue, arg->name))
return i + 1;
}
}
return result == 0 ? UINT32_MAX : result;
return UINT32_MAX;
}
static inline void appendInvalidPlaceholder(FFstrbuf* buffer, const char* start, const FFstrbuf* placeholderValue, uint32_t index, uint32_t formatStringLength)
@@ -103,6 +118,8 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
uint32_t numOpenNotIfs = 0;
uint32_t numOpenColors = 0;
FF_STRBUF_AUTO_DESTROY placeholderValue = ffStrbufCreate();
for(uint32_t i = 0; i < formatstr->length; ++i)
{
// if we don't have a placeholder start just copy the chars over to output buffer
@@ -136,67 +153,75 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
continue;
}
FF_STRBUF_AUTO_DESTROY placeholderValue = ffStrbufCreate();
ffStrbufClear(&placeholderValue);
while(i < formatstr->length && formatstr->chars[i] != '}')
ffStrbufAppendC(&placeholderValue, formatstr->chars[i++]);
// test if for stop, if so break the loop
if(placeholderValue.length == 1 && placeholderValue.chars[0] == '-')
break;
// test for end of an if, if so do nothing
if(placeholderValue.length == 1 && placeholderValue.chars[0] == '?')
{
if(numOpenIfs == 0)
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
else
--numOpenIfs;
continue;
uint32_t iEnd = ffStrbufNextIndexC(formatstr, i, '}');
ffStrbufAppendNS(&placeholderValue, iEnd - i, &formatstr->chars[i]);
i = iEnd;
}
// test for end of a not if, if so do nothing
if(placeholderValue.length == 1 && placeholderValue.chars[0] == '/')
{
if(numOpenNotIfs == 0)
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
else
--numOpenNotIfs;
char firstChar = placeholderValue.chars[0];
continue;
}
// test for end of a color, if so do nothing
if(placeholderValue.length == 1 && placeholderValue.chars[0] == '#')
if (placeholderValue.length == 1)
{
if(numOpenColors == 0)
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
else
// test if for stop, if so break the loop
if (firstChar == '-')
break;
// test for end of an if, if so do nothing
if (firstChar == '?')
{
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
--numOpenColors;
if(numOpenIfs == 0)
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
else
--numOpenIfs;
continue;
}
continue;
// test for end of a not if, if so do nothing
if (firstChar == '/')
{
if(numOpenNotIfs == 0)
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
else
--numOpenNotIfs;
continue;
}
// test for end of a color, if so do nothing
if (firstChar == '#')
{
if(numOpenColors == 0)
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
else
{
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
--numOpenColors;
}
continue;
}
}
// test for if, if so evaluate it
if(placeholderValue.chars[0] == '?')
if (firstChar == '?')
{
ffStrbufSubstrAfter(&placeholderValue, 0);
uint32_t index = getArgumentIndex(&placeholderValue);
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
// testing for an invalid index
if(index > numArgs)
if (index > numArgs)
{
appendInvalidPlaceholder(buffer, "{?", &placeholderValue, i, formatstr->length);
continue;
}
// continue normally if an format arg is set and the value is > 0
if(formatArgSet(&arguments[index - 1]))
if (formatArgSet(&arguments[index - 1]))
{
++numOpenIfs;
continue;
@@ -208,21 +233,21 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
}
// test for not if, if so evaluate it
if(placeholderValue.chars[0] == '/')
if (firstChar == '/')
{
ffStrbufSubstrAfter(&placeholderValue, 0);
uint32_t index = getArgumentIndex(&placeholderValue);
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
// testing for an invalid index
if(index > numArgs)
if (index > numArgs)
{
appendInvalidPlaceholder(buffer, "{/", &placeholderValue, i, formatstr->length);
continue;
}
//continue normally if an format arg is not set or the value is 0
if(!formatArgSet(&arguments[index - 1]))
if (!formatArgSet(&arguments[index - 1]))
{
++numOpenNotIfs;
continue;
@@ -234,7 +259,7 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
}
//test for color, if so evaluate it
if(placeholderValue.chars[0] == '#')
if (firstChar == '#')
{
++numOpenColors;
ffStrbufSubstrAfter(&placeholderValue, 0);
@@ -244,10 +269,10 @@ void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t n
continue;
}
uint32_t index = getArgumentIndex(&placeholderValue);
uint32_t index = getArgumentIndex(&placeholderValue, numArgs, arguments);
// test for invalid index
if(index > numArgs)
if (index > numArgs)
{
appendInvalidPlaceholder(buffer, "{", &placeholderValue, i, formatstr->length);
continue;
+1
View File
@@ -20,6 +20,7 @@ typedef struct FFformatarg
{
FFformatargtype type;
const void* value;
const char* name; // argument name, must start with an alphabet
} FFformatarg;
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
+1 -1
View File
@@ -38,7 +38,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
{
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 1, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex}
{FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex, "index"},
}));
ffStrbufWriteTo(&key, stdout);
}
+9 -3
View File
@@ -15,10 +15,16 @@ static inline char* realpath(const char* restrict file_name, char* restrict reso
const char* ffDetectEditor(FFEditorResult* result)
{
ffStrbufSetS(&result->name, getenv("VISUAL"));
if (result->name.length == 0)
if (result->name.length)
result->type = "Visual";
else
{
ffStrbufSetS(&result->name, getenv("EDITOR"));
if (result->name.length == 0)
return "$VISUAL or $EDITOR not set";
if (result->name.length)
result->type = "Editor";
else
return "$VISUAL or $EDITOR not set";
}
#ifndef _WIN32
if (result->name.chars[0] != '/')
+1
View File
@@ -4,6 +4,7 @@
typedef struct FFEditorResult
{
const char* type;
FFstrbuf name;
FFstrbuf exe;
FFstrbuf path;
+18 -18
View File
@@ -62,15 +62,15 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
ffTempsAppendNum(result->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_BATTERY_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BATTERY_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->technology},
{FF_FORMAT_ARG_TYPE_STRBUF, &capacityStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->status},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr},
{FF_FORMAT_ARG_TYPE_UINT, &result->cycleCount},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->serial},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufactureDate},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer, "manufacturer"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName, "model-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->technology, "technology"},
{FF_FORMAT_ARG_TYPE_STRBUF, &capacityStr, "capacity"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->status, "status"},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"},
{FF_FORMAT_ARG_TYPE_UINT, &result->cycleCount, "cycle-count"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->serial, "serial"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufactureDate, "manufacture-date"},
}));
}
}
@@ -222,15 +222,15 @@ void ffGenerateBatteryJsonResult(FFBatteryOptions* options, yyjson_mut_doc* doc,
void ffPrintBatteryHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BATTERY_MODULE_NAME, "{4}, {5}", FF_BATTERY_NUM_FORMAT_ARGS, ((const char* []) {
"Battery manufactor",
"Battery model",
"Battery technology",
"Battery capacity (percentage)",
"Battery status",
"Battery temperature (formatted)",
"Battery cycle count",
"Battery serial number",
"Battery manufactor date",
"Battery manufacturer - manufacturer",
"Battery model name - model-name",
"Battery technology - technology",
"Battery capacity (percentage) - capacity",
"Battery status - status",
"Battery temperature (formatted) - temperature",
"Battery cycle count - cycle-count",
"Battery serial number - serial",
"Battery manufactor date - manufacture-date",
}));
}
+11 -11
View File
@@ -44,7 +44,7 @@ void ffPrintBios(FFBiosOptions* options)
{
ffStrbufClear(&key);
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 1, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.type},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.type, "type"},
}));
}
@@ -60,11 +60,11 @@ void ffPrintBios(FFBiosOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BIOS_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.date},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.release},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.version},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.type},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.date, "date"},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.release, "release"},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.version, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &bios.type, "type"},
}));
}
@@ -146,11 +146,11 @@ exit:
void ffPrintBiosHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BIOS_MODULE_NAME, "{4} ({2})", FF_BIOS_NUM_FORMAT_ARGS, ((const char* []) {
"bios date",
"bios release",
"bios vendor",
"bios version",
"firmware type",
"bios date - date",
"bios release - release",
"bios vendor - vendor",
"bios version - version",
"firmware type - type",
}));
}
+11 -9
View File
@@ -5,7 +5,7 @@
#include "modules/bluetooth/bluetooth.h"
#include "util/stringUtils.h"
#define FF_BLUETOOTH_NUM_FORMAT_ARGS 4
#define FF_BLUETOOTH_NUM_FORMAT_ARGS 5
static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* device, uint8_t index)
{
@@ -33,10 +33,11 @@ static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* de
ffPercentAppendNum(&percentageStr, device->battery, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_BLUETOOTH_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BLUETOOTH_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->address},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->type},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr}
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->address, "address"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->type, "type"},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr, "battery-percentage"},
{FF_FORMAT_ARG_TYPE_BOOL, &device->connected, "connected"},
}));
}
}
@@ -174,10 +175,11 @@ void ffGenerateBluetoothJsonResult(FF_MAYBE_UNUSED FFBluetoothOptions* options,
void ffPrintBluetoothHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BLUETOOTH_MODULE_NAME, "{1} ({4})", FF_BLUETOOTH_NUM_FORMAT_ARGS, ((const char* []) {
"Name",
"Address",
"Type",
"Battery percentage"
"Name - name",
"Address - address",
"Type - type",
"Battery percentage - battery-percentage",
"Is connected - connected",
}));
}
+8 -8
View File
@@ -38,10 +38,10 @@ void ffPrintBoard(FFBoardOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BOARD_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &result.name},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.serial},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.serial, "serial"},
}));
}
@@ -125,10 +125,10 @@ exit:
void ffPrintBoardHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BOARD_MODULE_NAME, "{1} ({3})", FF_BOARD_NUM_FORMAT_ARGS, ((const char* []) {
"board name",
"board vendor",
"board version",
"board serial number",
"board name - name",
"board vendor - vendor",
"board version - version",
"board serial number - serial",
}));
}
+8 -8
View File
@@ -40,10 +40,10 @@ void ffPrintBootmgr(FFBootmgrOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_BOOTMGR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BOOTMGR_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &bootmgr.name},
{FF_FORMAT_ARG_TYPE_STRBUF, &bootmgr.firmware},
{FF_FORMAT_ARG_TYPE_STRBUF, &firmwareName},
{FF_FORMAT_ARG_TYPE_BOOL, &bootmgr.secureBoot},
{FF_FORMAT_ARG_TYPE_STRBUF, &bootmgr.name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &bootmgr.firmware, "firmware-path"},
{FF_FORMAT_ARG_TYPE_STRBUF, &firmwareName, "firmware-name"},
{FF_FORMAT_ARG_TYPE_BOOL, &bootmgr.secureBoot, "secure-boot"},
}));
}
@@ -114,10 +114,10 @@ exit:
void ffPrintBootmgrHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BOOTMGR_MODULE_NAME, "{4} ({2})", FF_BOOTMGR_NUM_FORMAT_ARGS, ((const char* []) {
"Name / description",
"Firmware file path",
"Firmware file name",
"Is secure boot enabled",
"Name / description - name",
"Firmware file path - firmware-path",
"Firmware file name - firmware-name",
"Is secure boot enabled - secure-boot",
}));
}
+12 -12
View File
@@ -38,8 +38,8 @@ void ffPrintBrightness(FFBrightnessOptions* options)
{
uint32_t moduleIndex = result.length == 1 ? 0 : index + 1;
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 2, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &moduleIndex},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->name}
{FF_FORMAT_ARG_TYPE_UINT, &moduleIndex, "index"},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->name, "name"},
}));
}
@@ -70,11 +70,11 @@ void ffPrintBrightness(FFBrightnessOptions* options)
FF_STRBUF_AUTO_DESTROY valueStr = ffStrbufCreate();
ffPercentAppendNum(&valueStr, percent, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BRIGHTNESS_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &valueStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->name},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->max},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->min},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->current},
{FF_FORMAT_ARG_TYPE_STRBUF, &valueStr, "percentage"},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->name, "name"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->max, "max"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->min, "min"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->current, "current"},
}));
}
@@ -175,11 +175,11 @@ void ffGenerateBrightnessJsonResult(FF_MAYBE_UNUSED FFBrightnessOptions* options
void ffPrintBrightnessHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BRIGHTNESS_MODULE_NAME, "{1}", FF_BRIGHTNESS_NUM_FORMAT_ARGS, ((const char* []) {
"Screen brightness (percentage)",
"Screen name",
"Maximum brightness value",
"Minimum brightness value",
"Current brightness value",
"Screen brightness (percentage) - percentage",
"Screen name - name",
"Maximum brightness value - max",
"Minimum brightness value - min",
"Current brightness value - current",
}));
}
+12 -12
View File
@@ -28,12 +28,12 @@ static void printDevice(FFCameraOptions* options, const FFCameraResult* device,
else
{
FF_PRINT_FORMAT_CHECKED(FF_CAMERA_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CAMERA_NUM_FORMAT_ARGS, (((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->colorspace},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->id},
{FF_FORMAT_ARG_TYPE_UINT, &device->width},
{FF_FORMAT_ARG_TYPE_UINT, &device->height},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->colorspace, "colorspace"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->id, "id"},
{FF_FORMAT_ARG_TYPE_UINT, &device->width, "width"},
{FF_FORMAT_ARG_TYPE_UINT, &device->height, "height"},
})));
}
}
@@ -139,12 +139,12 @@ void ffGenerateCameraJsonResult(FF_MAYBE_UNUSED FFCameraOptions* options, yyjson
void ffPrintCameraHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CAMERA_MODULE_NAME, "{1} ({4}px x {5}px)", FF_CAMERA_NUM_FORMAT_ARGS, ((const char* []) {
"Device name",
"Vendor",
"Color space",
"Identifier",
"Width (in px)",
"Height (in px)",
"Device name - name",
"Vendor - vendor",
"Color space - colorspace",
"Identifier - id",
"Width (in px) - width",
"Height (in px) - height",
}));
}
+8 -8
View File
@@ -39,10 +39,10 @@ void ffPrintChassis(FFChassisOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CHASSIS_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &result.type},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.serial},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.type, "type"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.serial, "serial"},
}));
}
@@ -126,10 +126,10 @@ exit:
void ffPrintChassisHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CHASSIS_MODULE_NAME, "{1}", FF_CHASSIS_NUM_FORMAT_ARGS, ((const char* []) {
"chassis type",
"chassis vendor",
"chassis version",
"chassis serial number",
"chassis type - type",
"chassis vendor - vendor",
"chassis version - version",
"chassis serial number - serial",
}));
}
+2 -2
View File
@@ -40,7 +40,7 @@ void ffPrintCommand(FFCommandOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_COMMAND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_COMMAND_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &result}
{FF_FORMAT_ARG_TYPE_STRBUF, &result, "result"}
}));
}
}
@@ -142,7 +142,7 @@ void ffGenerateCommandJsonResult(FF_MAYBE_UNUSED FFCommandOptions* options, yyjs
void ffPrintCommandHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_COMMAND_MODULE_NAME, "{1}", FF_COMMAND_NUM_FORMAT_ARGS, ((const char* []) {
"Command result"
"Command result - result"
}));
}
+20 -20
View File
@@ -107,16 +107,16 @@ void ffPrintCPU(FFCPUOptions* options)
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
ffTempsAppendNum(cpu.temperature, &tempStr, options->tempConfig, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPU_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &cpu.name},
{FF_FORMAT_ARG_TYPE_STRBUF, &cpu.vendor},
{FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresPhysical},
{FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresLogical},
{FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresOnline},
{FF_FORMAT_ARG_TYPE_STRING, freqBase},
{FF_FORMAT_ARG_TYPE_STRING, freqMax},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &coreTypes},
{FF_FORMAT_ARG_TYPE_STRING, freqBioslimit},
{FF_FORMAT_ARG_TYPE_STRBUF, &cpu.name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &cpu.vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresPhysical, "cores-physical"},
{FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresLogical, "cores-logical"},
{FF_FORMAT_ARG_TYPE_UINT16, &cpu.coresOnline, "cores-online"},
{FF_FORMAT_ARG_TYPE_STRING, freqBase, "freq-base"},
{FF_FORMAT_ARG_TYPE_STRING, freqMax, "freq-max"},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"},
{FF_FORMAT_ARG_TYPE_STRBUF, &coreTypes, "core-types"},
{FF_FORMAT_ARG_TYPE_STRING, freqBioslimit, "freq-bios-limit"},
}));
}
}
@@ -255,16 +255,16 @@ void ffGenerateCPUJsonResult(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_
void ffPrintCPUHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CPU_MODULE_NAME, "{1} ({5}) @ {7} GHz", FF_CPU_NUM_FORMAT_ARGS, ((const char* []) {
"Name",
"Vendor",
"Physical core count",
"Logical core count",
"Online core count",
"Base frequency",
"Max frequency",
"Temperature (formatted)",
"Logical core count grouped by frequency",
"Bios limited frequency",
"Name - name",
"Vendor - vendor",
"Physical core count - cores-physical",
"Logical core count - cores-logical",
"Online core count - cores-online",
"Base frequency - freq-base",
"Max frequency - freq-max",
"Temperature (formatted) - temperature",
"Logical core count grouped by frequency - core-types",
"Bios limited frequency - freq-bios-limit",
}));
}
+10 -10
View File
@@ -80,11 +80,11 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
FF_STRBUF_AUTO_DESTROY maxStr = ffStrbufCreate();
ffPercentAppendNum(&maxStr, maxValue, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_CPUUSAGE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPUUSAGE_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &avgStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &maxStr},
{FF_FORMAT_ARG_TYPE_UINT, &maxIndex},
{FF_FORMAT_ARG_TYPE_STRBUF, &minStr},
{FF_FORMAT_ARG_TYPE_UINT, &minIndex},
{FF_FORMAT_ARG_TYPE_STRBUF, &avgStr, "avg"},
{FF_FORMAT_ARG_TYPE_STRBUF, &maxStr, "max"},
{FF_FORMAT_ARG_TYPE_UINT, &maxIndex, "max-index"},
{FF_FORMAT_ARG_TYPE_STRBUF, &minStr, "min"},
{FF_FORMAT_ARG_TYPE_UINT, &minIndex, "min-index"},
}));
}
}
@@ -167,11 +167,11 @@ void ffGenerateCPUUsageJsonResult(FF_MAYBE_UNUSED FFCPUUsageOptions* options, yy
void ffPrintCPUUsageHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CPUUSAGE_MODULE_NAME, "{1}", FF_CPUUSAGE_NUM_FORMAT_ARGS, ((const char* []) {
"CPU usage (percentage, average)",
"CPU usage (percentage, maximum)",
"CPU core index of maximum usage",
"CPU usage (percentage, minimum)",
"CPU core index of minimum usage",
"CPU usage (percentage, average) - avg",
"CPU usage (percentage, maximum) - max",
"CPU core index of maximum usage - max-index",
"CPU usage (percentage, minimum) - min",
"CPU core index of minimum usage - min-index",
}));
}
+4 -4
View File
@@ -39,8 +39,8 @@ void ffPrintCursor(FFCursorOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_CURSOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CURSOR_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &result.theme},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.size}
{FF_FORMAT_ARG_TYPE_STRBUF, &result.theme, "theme"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.size, "size"},
}));
}
}
@@ -113,8 +113,8 @@ void ffGenerateCursorJsonResult(FF_MAYBE_UNUSED FFCursorOptions* options, yyjson
void ffPrintCursorHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CURSOR_MODULE_NAME, "{1} ({2}px)", FF_CURSOR_NUM_FORMAT_ARGS, ((const char* []) {
"Cursor theme",
"Cursor size"
"Cursor theme - theme",
"Cursor size - size"
}));
}
+44 -44
View File
@@ -66,28 +66,28 @@ void ffPrintDateTimeFormat(struct tm* tm, const FFModuleArgs* moduleArgs)
strftime(result.timezoneName, sizeof(result.timezoneName), "%Z", tm);
FF_PRINT_FORMAT_CHECKED(FF_DATETIME_DISPLAY_NAME, 0, moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_DATETIME_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_UINT16, &result.year}, // 1
{FF_FORMAT_ARG_TYPE_UINT8, &result.yearShort}, // 2
{FF_FORMAT_ARG_TYPE_UINT8, &result.month}, // 3
{FF_FORMAT_ARG_TYPE_STRING, result.monthPretty}, // 4
{FF_FORMAT_ARG_TYPE_STRING, result.monthName}, // 5
{FF_FORMAT_ARG_TYPE_STRING, result.monthNameShort}, // 6
{FF_FORMAT_ARG_TYPE_UINT8, &result.week}, // 7
{FF_FORMAT_ARG_TYPE_STRING, result.weekday}, // 8
{FF_FORMAT_ARG_TYPE_STRING, result.weekdayShort}, // 9
{FF_FORMAT_ARG_TYPE_UINT16, &result.dayInYear}, // 10
{FF_FORMAT_ARG_TYPE_UINT8, &result.dayInMonth}, // 11
{FF_FORMAT_ARG_TYPE_UINT8, &result.dayInWeek}, // 12
{FF_FORMAT_ARG_TYPE_UINT8, &result.hour}, // 13
{FF_FORMAT_ARG_TYPE_STRING, result.hourPretty}, // 14
{FF_FORMAT_ARG_TYPE_UINT8, &result.hour12}, // 15
{FF_FORMAT_ARG_TYPE_STRING, result.hour12Pretty}, // 16
{FF_FORMAT_ARG_TYPE_UINT8, &result.minute}, // 17
{FF_FORMAT_ARG_TYPE_STRING, result.minutePretty}, // 18
{FF_FORMAT_ARG_TYPE_UINT8, &result.second}, // 19
{FF_FORMAT_ARG_TYPE_STRING, result.secondPretty}, // 20
{FF_FORMAT_ARG_TYPE_STRING, result.offsetFromUtc}, // 21
{FF_FORMAT_ARG_TYPE_STRING, result.timezoneName}, // 22
{FF_FORMAT_ARG_TYPE_UINT16, &result.year, "year"}, // 1
{FF_FORMAT_ARG_TYPE_UINT8, &result.yearShort, "year-short"}, // 2
{FF_FORMAT_ARG_TYPE_UINT8, &result.month, "month"}, // 3
{FF_FORMAT_ARG_TYPE_STRING, result.monthPretty, "month-pretty"}, // 4
{FF_FORMAT_ARG_TYPE_STRING, result.monthName, "month-name"}, // 5
{FF_FORMAT_ARG_TYPE_STRING, result.monthNameShort, "month-name-short"}, // 6
{FF_FORMAT_ARG_TYPE_UINT8, &result.week, "week"}, // 7
{FF_FORMAT_ARG_TYPE_STRING, result.weekday, "weekday"}, // 8
{FF_FORMAT_ARG_TYPE_STRING, result.weekdayShort, "weekday-short"}, // 9
{FF_FORMAT_ARG_TYPE_UINT16, &result.dayInYear, "day-in-year"}, // 10
{FF_FORMAT_ARG_TYPE_UINT8, &result.dayInMonth, "day-in-month"}, // 11
{FF_FORMAT_ARG_TYPE_UINT8, &result.dayInWeek, "day-in-week"}, // 12
{FF_FORMAT_ARG_TYPE_UINT8, &result.hour, "hour"}, // 13
{FF_FORMAT_ARG_TYPE_STRING, result.hourPretty, "hour-pretty"}, // 14
{FF_FORMAT_ARG_TYPE_UINT8, &result.hour12, "hour-12"}, // 15
{FF_FORMAT_ARG_TYPE_STRING, result.hour12Pretty, "hour-12-pretty"}, // 16
{FF_FORMAT_ARG_TYPE_UINT8, &result.minute, "minute"}, // 17
{FF_FORMAT_ARG_TYPE_STRING, result.minutePretty, "minute-pretty"}, // 18
{FF_FORMAT_ARG_TYPE_UINT8, &result.second, "second"}, // 19
{FF_FORMAT_ARG_TYPE_STRING, result.secondPretty, "second-pretty"}, // 20
{FF_FORMAT_ARG_TYPE_STRING, result.offsetFromUtc, "offset-from-utc"}, // 21
{FF_FORMAT_ARG_TYPE_STRING, result.timezoneName, "timezone-name"}, // 22
}));
}
@@ -158,28 +158,28 @@ void ffGenerateDateTimeJsonResult(FF_MAYBE_UNUSED FFDateTimeOptions* options, yy
void ffPrintDateTimeHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DATETIME_MODULE_NAME, "{1}-{4}-{11} {14}:{18}:{20}", FF_DATETIME_NUM_FORMAT_ARGS, ((const char* []) {
"year",
"last two digits of year",
"month",
"month with leading zero",
"month name",
"month name short",
"week number on year",
"weekday",
"weekday short",
"day in year",
"day in month",
"day in Week",
"hour",
"hour with leading zero",
"hour 12h format",
"hour 12h format with leading zero",
"minute",
"minute with leading zero",
"second",
"second with leading zero",
"offset from UTC in the ISO 8601 format",
"locale-dependent timezone name or abbreviation",
"year - year",
"last two digits of year - year-short",
"month - month",
"month with leading zero - month-pretty",
"month name - month-name",
"month name short - month-name-short",
"week number on year - week",
"weekday - weekday",
"weekday short - weekday-short",
"day in year - day-in-year",
"day in month - day-in-month",
"day in week - day-in-week",
"hour - hour",
"hour with leading zero - hour-pretty",
"hour 12h format - hour-12",
"hour 12h format with leading zero - hour-12-pretty",
"minute - minute",
"minute with leading zero - minute-pretty",
"second - second",
"second with leading zero - second-pretty",
"offset from UTC in the ISO 8601 format - offset-from-utc",
"locale-dependent timezone name or abbreviation - timezone-name",
}));
}
+6 -6
View File
@@ -37,9 +37,9 @@ void ffPrintDE(FFDEOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_DE_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &result->deProcessName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->dePrettyName},
{FF_FORMAT_ARG_TYPE_STRBUF, &version}
{FF_FORMAT_ARG_TYPE_STRBUF, &result->deProcessName, "process-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->dePrettyName, "pretty-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &version, "version"}
}));
}
}
@@ -116,9 +116,9 @@ void ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc
void ffPrintDEHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DE_MODULE_NAME, "{2} {3}", FF_DE_NUM_FORMAT_ARGS, ((const char* []) {
"DE process name",
"DE pretty name",
"DE version"
"DE process name - process-name",
"DE pretty name - pretty-name",
"DE version - version"
}));
}
+27 -27
View File
@@ -36,9 +36,9 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
else
{
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->mountpoint},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->mountFrom},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->mountpoint, "mountpoint"},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->mountFrom, "mount-from"},
}));
}
@@ -115,18 +115,18 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
bool isReadOnly = !!(disk->type & FF_DISK_VOLUME_TYPE_READONLY_BIT);
FF_PRINT_FORMAT_CHECKED(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},
{FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageStr},
{FF_FORMAT_ARG_TYPE_UINT, &disk->filesUsed},
{FF_FORMAT_ARG_TYPE_UINT, &disk->filesTotal},
{FF_FORMAT_ARG_TYPE_STRBUF, &filesPercentageStr},
{FF_FORMAT_ARG_TYPE_BOOL, &isExternal},
{FF_FORMAT_ARG_TYPE_BOOL, &isHidden},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->filesystem},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->name},
{FF_FORMAT_ARG_TYPE_BOOL, &isReadOnly},
{FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(disk->createTime)},
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "size-used"},
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "size-total"},
{FF_FORMAT_ARG_TYPE_STRBUF, &bytesPercentageStr, "size-percentage"},
{FF_FORMAT_ARG_TYPE_UINT, &disk->filesUsed, "files-used"},
{FF_FORMAT_ARG_TYPE_UINT, &disk->filesTotal, "files-total"},
{FF_FORMAT_ARG_TYPE_STRBUF, &filesPercentageStr, "files-percentage"},
{FF_FORMAT_ARG_TYPE_BOOL, &isExternal, "is-external"},
{FF_FORMAT_ARG_TYPE_BOOL, &isHidden, "is-hidden"},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->filesystem, "filesystem"},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->name, "name"},
{FF_FORMAT_ARG_TYPE_BOOL, &isReadOnly, "is-readonly"},
{FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(disk->createTime), "create-time"},
}));
}
}
@@ -428,18 +428,18 @@ void ffGenerateDiskJsonResult(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
void ffPrintDiskHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DISK_MODULE_NAME, "{1} / {2} ({3}) - {9}", FF_DISK_NUM_FORMAT_ARGS, ((const char* []) {
"Size used",
"Size total",
"Size percentage",
"Files used",
"Files total",
"Files percentage",
"True if external volume",
"True if hidden volume",
"Filesystem",
"Label / name",
"True if read-only",
"Create time in local timezone",
"Size used - size-used",
"Size total - size-total",
"Size percentage - size-percentage",
"Files used - files-used",
"Files total - files-total",
"Files percentage - files-percentage",
"True if external volume - is-external",
"True if hidden volume - is-hidden",
"Filesystem - filesystem",
"Label / name - name",
"True if read-only - is-readonly",
"Create time in local timezone - create-time",
}));
}
+19 -19
View File
@@ -23,9 +23,9 @@ static void formatKey(const FFDiskIOOptions* options, FFDiskIOResult* dev, uint3
{
ffStrbufClear(key);
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 3, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &index},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath},
{FF_FORMAT_ARG_TYPE_UINT, &index, "index"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath, "dev-path"},
}));
}
}
@@ -75,14 +75,14 @@ void ffPrintDiskIO(FFDiskIOOptions* options)
if (!options->detectTotal) ffStrbufAppendS(&buffer, "/s");
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISKIO_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer},
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer2},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath},
{FF_FORMAT_ARG_TYPE_UINT64, &dev->bytesRead},
{FF_FORMAT_ARG_TYPE_UINT64, &dev->bytesWritten},
{FF_FORMAT_ARG_TYPE_UINT64, &dev->readCount},
{FF_FORMAT_ARG_TYPE_UINT64, &dev->writeCount},
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "size-read"},
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer2, "size-written"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath, "dev-path"},
{FF_FORMAT_ARG_TYPE_UINT64, &dev->bytesRead, "bytes-read"},
{FF_FORMAT_ARG_TYPE_UINT64, &dev->bytesWritten, "bytes-written"},
{FF_FORMAT_ARG_TYPE_UINT64, &dev->readCount, "read-count"},
{FF_FORMAT_ARG_TYPE_UINT64, &dev->writeCount, "write-count"},
}));
}
++index;
@@ -193,14 +193,14 @@ void ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, y
void ffPrintDiskIOHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DISKIO_MODULE_NAME, "{1} (R) - {2} (W)", FF_DISKIO_NUM_FORMAT_ARGS, ((const char* []) {
"Size of data read [per second] (formatted)",
"Size of data written [per second] (formatted)",
"Device name",
"Device raw file path",
"Size of data read [per second] (in bytes)",
"Size of data written [per second] (in bytes)",
"Number of reads",
"Number of writes",
"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",
"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",
"Number of writes - write-count",
}));
}
+21 -21
View File
@@ -90,9 +90,9 @@ void ffPrintDisplay(FFDisplayOptions* options)
else
{
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &moduleIndex},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name},
{FF_FORMAT_ARG_TYPE_STRING, displayType},
{FF_FORMAT_ARG_TYPE_UINT, &moduleIndex, "index"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"},
{FF_FORMAT_ARG_TYPE_STRING, displayType, "type"},
}));
}
@@ -126,15 +126,15 @@ void ffPrintDisplay(FFDisplayOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISPLAY_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_UINT, &result->width},
{FF_FORMAT_ARG_TYPE_UINT, &result->height},
{FF_FORMAT_ARG_TYPE_DOUBLE, &result->refreshRate},
{FF_FORMAT_ARG_TYPE_UINT, &result->scaledWidth},
{FF_FORMAT_ARG_TYPE_UINT, &result->scaledHeight},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name},
{FF_FORMAT_ARG_TYPE_STRING, displayType},
{FF_FORMAT_ARG_TYPE_UINT, &result->rotation},
{FF_FORMAT_ARG_TYPE_BOOL, &result->primary},
{FF_FORMAT_ARG_TYPE_UINT, &result->width, "width"},
{FF_FORMAT_ARG_TYPE_UINT, &result->height, "height"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &result->refreshRate, "refresh-rate"},
{FF_FORMAT_ARG_TYPE_UINT, &result->scaledWidth, "scaled-width"},
{FF_FORMAT_ARG_TYPE_UINT, &result->scaledHeight, "scaled-height"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"},
{FF_FORMAT_ARG_TYPE_STRING, displayType, "type"},
{FF_FORMAT_ARG_TYPE_UINT, &result->rotation, "rotation"},
{FF_FORMAT_ARG_TYPE_BOOL, &result->primary, "is-primary"},
}));
}
}
@@ -311,15 +311,15 @@ void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
void ffPrintDisplayHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DISPLAY_MODULE_NAME, "{1}x{2} @ {3}Hz (as {4}x{5}) [{7}]", FF_DISPLAY_NUM_FORMAT_ARGS, ((const char* []) {
"Screen width (in pixels)",
"Screen height (in pixels)",
"Screen refresh rate (in Hz)",
"Screen scaled width (in pixels)",
"Screen scaled height (in pixels)",
"Screen name",
"Screen type (builtin, external or unknown)",
"Screen rotation (in degrees)",
"True if being the primary screen",
"Screen width (in pixels) - width",
"Screen height (in pixels) - height",
"Screen 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 (builtin, external or unknown) - type",
"Screen rotation (in degrees) - rotation",
"True if being the primary screen - is-primary",
}));
}
+26 -12
View File
@@ -5,7 +5,7 @@
#include "modules/editor/editor.h"
#include "util/stringUtils.h"
#define FF_EDITOR_NUM_FORMAT_ARGS 4
#define FF_EDITOR_NUM_FORMAT_ARGS 5
void ffPrintEditor(FFEditorOptions* options)
{
@@ -23,18 +23,31 @@ void ffPrintEditor(FFEditorOptions* options)
return;
}
ffPrintLogoAndKey(FF_EDITOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
if (result.exe.length)
if (options->moduleArgs.outputFormat.length == 0)
{
ffStrbufWriteTo(&result.exe, stdout);
if (result.version.length)
printf(" (%s)", result.version.chars);
ffPrintLogoAndKey(FF_EDITOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
if (result.exe.length)
{
ffStrbufWriteTo(&result.exe, stdout);
if (result.version.length)
printf(" (%s)", result.version.chars);
}
else
{
ffStrbufWriteTo(&result.name, stdout);
}
putchar('\n');
}
else
{
ffStrbufWriteTo(&result.name, stdout);
FF_PRINT_FORMAT_CHECKED(FF_EDITOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_EDITOR_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRING, &result.type, "type"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.exe, "exe-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.path, "path"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"},
}));
}
putchar('\n');
ffStrbufDestroy(&result.name);
ffStrbufDestroy(&result.path);
@@ -108,10 +121,11 @@ void ffGenerateEditorJsonResult(FF_MAYBE_UNUSED FFEditorOptions* options, yyjson
void ffPrintEditorHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_EDITOR_MODULE_NAME, "{2} ({4})", FF_EDITOR_NUM_FORMAT_ARGS, ((const char* []) {
"Name",
"Exe name",
"Full path",
"Version",
"Type (Visual / Editor) - type",
"Name - name",
"Exe name of real path - exe-name",
"Full path of real path - full-path",
"Version - version",
}));
}
+10 -10
View File
@@ -29,11 +29,11 @@ void ffPrintFont(FFFontOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_FONT_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[0]},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[1]},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[2]},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[3]},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.display},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[0], "font1"},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[1], "font2"},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[2], "font3"},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.fonts[3], "font4"},
{FF_FORMAT_ARG_TYPE_STRBUF, &font.display, "combined"},
}));
}
}
@@ -107,11 +107,11 @@ void ffGenerateFontJsonResult(FF_MAYBE_UNUSED FFFontOptions* options, yyjson_mut
void ffPrintFontHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_FONT_MODULE_NAME, "{5}", FF_FONT_NUM_FORMAT_ARGS, ((const char* []) {
"Font 1",
"Font 2",
"Font 3",
"Font 4",
"Combined fonts"
"Font 1 - font1",
"Font 2 - font2",
"Font 3 - font3",
"Font 4 - font4",
"Combined fonts for display - combined"
}));
}
+6 -6
View File
@@ -29,9 +29,9 @@ static void printDevice(FFGamepadOptions* options, const FFGamepadDevice* device
ffPercentAppendNum(&percentageStr, device->battery, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_GAMEPAD_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GAMEPAD_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->serial},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->serial, "serial"},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr, "battery-percentage"},
}));
}
}
@@ -136,9 +136,9 @@ void ffGenerateGamepadJsonResult(FF_MAYBE_UNUSED FFGamepadOptions* options, yyjs
void ffPrintGamepadHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_GAMEPAD_MODULE_NAME, "{1} ({3})", FF_GAMEPAD_NUM_FORMAT_ARGS, ((const char* []) {
"Name",
"Serial number",
"Battery percentage",
"Name - name",
"Serial number - serial",
"Battery percentage - battery-percentage",
}));
}
+24 -24
View File
@@ -76,18 +76,18 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
ffTempsAppendNum(gpu->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GPU_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->driver},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr},
{FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount},
{FF_FORMAT_ARG_TYPE_STRING, type},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.total},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.used},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.total},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.used},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->platformApi},
{FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->frequency},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->driver, "driver"},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"},
{FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount, "core-count"},
{FF_FORMAT_ARG_TYPE_STRING, type, "type"},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.total, "dedicated-total"},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.used, "dedicated-used"},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.total, "shared-total"},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.used, "shared-used"},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->platformApi, "platform-api"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->frequency, "frequency"},
}));
}
}
@@ -368,18 +368,18 @@ void ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
void ffPrintGPUHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_GPU_MODULE_NAME, "{1} {2}", FF_GPU_NUM_FORMAT_ARGS, ((const char* []) {
"GPU vendor",
"GPU name",
"GPU driver",
"GPU temperature",
"GPU core count",
"GPU type",
"GPU total dedicated memory",
"GPU used dedicated memory",
"GPU total shared memory",
"GPU used shared memory",
"The platform API that GPU supports",
"Current frequency in GHz",
"GPU vendor - vendor",
"GPU name - name",
"GPU driver - driver",
"GPU temperature - temperature",
"GPU core count - core-count",
"GPU type - type",
"GPU total dedicated memory - dedicated-total",
"GPU used dedicated memory - dedicated-used",
"GPU total shared memory - shared-total",
"GPU used shared memory - shared-used",
"The platform API used when detecting the GPU - platform-api",
"Current frequency in GHz - frequency",
}));
}
+14 -14
View File
@@ -49,13 +49,13 @@ void ffPrintHost(FFHostOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_HOST_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_HOST_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &host.family},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.name},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.version},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.sku},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.serial},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.uuid},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.family, "family"},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.version, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.sku, "sku"},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.serial, "serial"},
{FF_FORMAT_ARG_TYPE_STRBUF, &host.uuid, "uuid"},
}));
}
@@ -150,13 +150,13 @@ exit:
void ffPrintHostHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_HOST_MODULE_NAME, "{2} {3}", FF_HOST_NUM_FORMAT_ARGS, ((const char* []) {
"product family",
"product name",
"product version",
"product sku",
"product vendor",
"product serial number",
"product uuid",
"product family - family",
"product name - name",
"product version - version",
"product sku - sku",
"product vendor - vendor",
"product serial number - serial",
"product uuid - uuid",
}));
}
+2 -2
View File
@@ -25,7 +25,7 @@ void ffPrintIcons(FFIconsOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_ICONS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_ICONS_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &icons}
{FF_FORMAT_ARG_TYPE_STRBUF, &icons, "combined"}
}));
}
}
@@ -82,7 +82,7 @@ void ffGenerateIconsJsonResult(FF_MAYBE_UNUSED FFIconsOptions* options, yyjson_m
void ffPrintIconsHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_ICONS_MODULE_NAME, "{1}", FF_ICONS_NUM_FORMAT_ARGS, ((const char* []) {
"Combined icons"
"Combined icons - combined"
}));
}
+10 -10
View File
@@ -21,11 +21,11 @@ void ffPrintKernel(FFKernelOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_KERNEL_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemName},
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemRelease},
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemVersion},
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemArchitecture},
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemDisplayVersion}
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemName, "sysname"},
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemRelease, "release"},
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemVersion, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemArchitecture, "arch"},
{FF_FORMAT_ARG_TYPE_STRBUF, &platform->systemDisplayVersion, "display-version"},
}));
}
}
@@ -78,11 +78,11 @@ void ffGenerateKernelJsonResult(FF_MAYBE_UNUSED FFKernelOptions* options, yyjson
void ffPrintKernelHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_KERNEL_MODULE_NAME, "{1} {2}", FF_KERNEL_NUM_FORMAT_ARGS, ((const char* []) {
"Sysname",
"Release",
"Version",
"Architecture",
"Display version",
"Sysname - sysname",
"Release - release",
"Version - version",
"Architecture - arch",
"Display version - display-version",
}));
}
+6 -6
View File
@@ -39,9 +39,9 @@ void ffPrintLM(FFLMOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LM_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &result.service},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.type},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.service, "service"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.type, "type"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"},
}));
}
ffStrbufDestroy(&result.service);
@@ -118,9 +118,9 @@ exit:
void ffPrintLMHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_LM_MODULE_NAME, "{1} {3} ({2})", FF_LM_NUM_FORMAT_ARGS, ((const char* []) {
"LM service",
"LM type",
"LM version"
"LM service - service",
"LM type - type",
"LM version - version"
}));
}
+6 -6
View File
@@ -25,9 +25,9 @@ void ffPrintLoadavg(FFLoadavgOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_LOADAVG_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LOADAVG_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_DOUBLE, &result[0]},
{FF_FORMAT_ARG_TYPE_DOUBLE, &result[1]},
{FF_FORMAT_ARG_TYPE_DOUBLE, &result[2]},
{FF_FORMAT_ARG_TYPE_DOUBLE, &result[0], "loadavg1"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &result[1], "loadavg2"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &result[2], "loadavg3"},
}));
}
}
@@ -101,9 +101,9 @@ void ffGenerateLoadavgJsonResult(FF_MAYBE_UNUSED FFLoadavgOptions* options, yyjs
void ffPrintLoadavgHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_LOADAVG_MODULE_NAME, "{1}, {2}, {3}", FF_LOADAVG_NUM_FORMAT_ARGS, ((const char* []) {
"Load average over 1min",
"Load average over 5min",
"Load average over 15min",
"Load average over 1min - loadavg1",
"Load average over 5min - loadavg2",
"Load average over 15min - loadavg3",
}));
}
+2 -2
View File
@@ -25,7 +25,7 @@ void ffPrintLocale(FFLocaleOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_LOCALE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LOCALE_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &locale}
{FF_FORMAT_ARG_TYPE_STRBUF, &locale, "result"}
}));
}
}
@@ -82,7 +82,7 @@ void ffGenerateLocaleJsonResult(FF_MAYBE_UNUSED FFLocaleOptions* options, yyjson
void ffPrintLocaleHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_LOCALE_MODULE_NAME, "{1}", FF_LOCALE_NUM_FORMAT_ARGS, ((const char* []) {
"Locale code"
"Locale code - result"
}));
}
+13 -13
View File
@@ -26,9 +26,9 @@ static void formatKey(const FFLocalIpOptions* options, FFLocalIpResult* ip, uint
{
ffStrbufClear(key);
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 3, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &index},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->mac},
{FF_FORMAT_ARG_TYPE_UINT, &index, "index"},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->mac, "mac"},
}));
}
}
@@ -111,11 +111,11 @@ void ffPrintLocalIp(FFLocalIpOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_LOCALIP_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->ipv4},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->ipv6},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->mac},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->name},
{FF_FORMAT_ARG_TYPE_BOOL, &ip->defaultRoute},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->ipv4, "ipv4"},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->ipv6, "ipv6"},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->mac, "mac"},
{FF_FORMAT_ARG_TYPE_STRBUF, &ip->name, "ifname"},
{FF_FORMAT_ARG_TYPE_BOOL, &ip->defaultRoute, "is-default-route"},
}));
}
++index;
@@ -387,11 +387,11 @@ void ffGenerateLocalIpJsonResult(FF_MAYBE_UNUSED FFLocalIpOptions* options, yyjs
void ffPrintLocalIpHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_LOCALIP_MODULE_NAME, "{1}", FF_LOCALIP_NUM_FORMAT_ARGS, ((const char* []) {
"Local IPv4 address",
"Local IPv6 address",
"Physical (MAC) address",
"Interface name",
"Is default route"
"Local IPv4 address - ipv4",
"Local IPv6 address - ipv6",
"Physical (MAC) address - mac",
"Interface name - ifname",
"Is default route - is-default-route"
}));
}
+10 -10
View File
@@ -96,11 +96,11 @@ void ffPrintMedia(FFMediaOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_MEDIA_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MEDIA_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &songPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->song},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->artist},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->album},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->status}
{FF_FORMAT_ARG_TYPE_STRBUF, &songPretty, "combined"},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->song, "title"},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->artist, "artist"},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->album, "album"},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->status, "status"},
}));
}
}
@@ -160,11 +160,11 @@ void ffGenerateMediaJsonResult(FF_MAYBE_UNUSED FFMediaOptions* options, yyjson_m
void ffPrintMediaHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_MEDIA_MODULE_NAME, "{3} - {1} ({5})", FF_MEDIA_NUM_FORMAT_ARGS, ((const char* []) {
"Pretty media name",
"Media name",
"Artist name",
"Album name",
"Status",
"Pretty media name - combined",
"Media name - title",
"Artist name - artist",
"Album name - album",
"Status - status",
}));
}
+6 -6
View File
@@ -59,9 +59,9 @@ void ffPrintMemory(FFMemoryOptions* options)
FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate();
ffPercentAppendNum(&percentageStr, percentage, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "used"},
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "total"},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr, "percentage"},
}));
}
}
@@ -128,9 +128,9 @@ void ffGenerateMemoryJsonResult(FF_MAYBE_UNUSED FFMemoryOptions* options, yyjson
void ffPrintMemoryHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_MEMORY_MODULE_NAME, "{1} / {2} ({3})", FF_MEMORY_NUM_FORMAT_ARGS, ((const char* []) {
"Used size",
"Total size",
"Percentage used",
"Used size - used",
"Total size - total",
"Percentage used - percentage",
}));
}
+22 -22
View File
@@ -42,8 +42,8 @@ void ffPrintMonitor(FFMonitorOptions* options)
{
uint32_t moduleIndex = result.length == 1 ? 0 : index + 1;
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 2, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &moduleIndex},
{FF_FORMAT_ARG_TYPE_STRBUF, &display->name},
{FF_FORMAT_ARG_TYPE_UINT, &moduleIndex, "index"},
{FF_FORMAT_ARG_TYPE_STRBUF, &display->name, "name"},
}));
}
@@ -69,16 +69,16 @@ void ffPrintMonitor(FFMonitorOptions* options)
buf[0] = '\0';
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_MONITOR_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &display->name},
{FF_FORMAT_ARG_TYPE_UINT, &display->width},
{FF_FORMAT_ARG_TYPE_UINT, &display->height},
{FF_FORMAT_ARG_TYPE_UINT, &display->physicalWidth},
{FF_FORMAT_ARG_TYPE_UINT, &display->physicalHeight},
{FF_FORMAT_ARG_TYPE_DOUBLE, &inch},
{FF_FORMAT_ARG_TYPE_DOUBLE, &ppi},
{FF_FORMAT_ARG_TYPE_UINT16, &display->manufactureYear},
{FF_FORMAT_ARG_TYPE_UINT16, &display->manufactureWeek},
{FF_FORMAT_ARG_TYPE_STRING, buf},
{FF_FORMAT_ARG_TYPE_STRBUF, &display->name, "name"},
{FF_FORMAT_ARG_TYPE_UINT, &display->width, "width"},
{FF_FORMAT_ARG_TYPE_UINT, &display->height, "height"},
{FF_FORMAT_ARG_TYPE_UINT, &display->physicalWidth, "physical-width"},
{FF_FORMAT_ARG_TYPE_UINT, &display->physicalHeight, "physical-height"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &inch, "inch"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &ppi, "ppi"},
{FF_FORMAT_ARG_TYPE_UINT16, &display->manufactureYear, "manufacture-year"},
{FF_FORMAT_ARG_TYPE_UINT16, &display->manufactureWeek, "manufacture-week"},
{FF_FORMAT_ARG_TYPE_STRING, buf, "serial"},
}));
}
@@ -180,16 +180,16 @@ void ffGenerateMonitorJsonResult(FF_MAYBE_UNUSED FFMonitorOptions* options, yyjs
void ffPrintMonitorHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_MONITOR_MODULE_NAME, "{2}x{3} px - {4}x{5} mm ({6} inches, {7} ppi)", FF_MONITOR_NUM_FORMAT_ARGS, ((const char* []) {
"Display name",
"Native resolution width in pixels",
"Native resolution height in pixels",
"Physical width in millimeters",
"Physical height in millimeters",
"Physical diagonal length in inches",
"Pixels per inch (PPI)",
"Year of manufacturing",
"Nth week of manufacturing in the year",
"Serial number",
"Display name - name",
"Native resolution width in pixels - width",
"Native resolution height in pixels - height",
"Physical width in millimeters - physical-width",
"Physical height in millimeters - physical-height",
"Physical diagonal length in inches - inch",
"Pixels per inch (PPI) - ppi",
"Year of manufacturing - manufacture-year",
"Nth week of manufacturing in the year - manufacture-week",
"Serial number - serial",
}));
}
+26 -26
View File
@@ -26,8 +26,8 @@ static void formatKey(const FFNetIOOptions* options, FFNetIOResult* inf, uint32_
{
ffStrbufClear(key);
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 2, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &index},
{FF_FORMAT_ARG_TYPE_STRBUF, &inf->name},
{FF_FORMAT_ARG_TYPE_UINT, &index, "index"},
{FF_FORMAT_ARG_TYPE_STRBUF, &inf->name, "name"},
}));
}
}
@@ -80,18 +80,18 @@ void ffPrintNetIO(FFNetIOOptions* options)
if (!options->detectTotal) ffStrbufAppendS(&buffer2, "/s");
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_NETIO_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer},
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer2},
{FF_FORMAT_ARG_TYPE_STRBUF, &inf->name},
{FF_FORMAT_ARG_TYPE_BOOL, &inf->defaultRoute},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txBytes},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxBytes},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txPackets},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxPackets},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxErrors},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txErrors},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxDrops},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txDrops},
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "rx-size"},
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer2, "tx-size"},
{FF_FORMAT_ARG_TYPE_STRBUF, &inf->name, "ifname"},
{FF_FORMAT_ARG_TYPE_BOOL, &inf->defaultRoute, "is-default-route"},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txBytes, "tx-bytes"},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxBytes, "rx-bytes"},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txPackets, "tx-packets"},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxPackets, "rx-packets"},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxErrors, "rx-errors"},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txErrors, "tx-errors"},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxDrops, "rx-drops"},
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txDrops, "tx-drops"},
}));
}
++index;
@@ -219,18 +219,18 @@ void ffGenerateNetIOJsonResult(FFNetIOOptions* options, yyjson_mut_doc* doc, yyj
void ffPrintNetIOHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_NETIO_MODULE_NAME, "{1} (IN) - {2} (OUT)", FF_NETIO_NUM_FORMAT_ARGS, ((const char* []) {
"Size of data received [per second] (formatted)",
"Size of data sent [per second] (formatted)",
"Interface name",
"Is default route",
"Size of data received [per second] (in bytes)",
"Size of data sent [per second] (in bytes)",
"Number of packets received [per second]",
"Number of packets sent [per second]",
"Number of errors received [per second]",
"Number of errors sent [per second]",
"Number of packets dropped when receiving [per second]",
"Number of packets dropped when sending [per second]",
"Size of data received [per second] (formatted) - rx-size",
"Size of data sent [per second] (formatted) - tx-size",
"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",
"Number of packets received [per second] - rx-packets",
"Number of packets sent [per second] - tx-packets",
"Number of errors received [per second] - rx-errors",
"Number of errors sent [per second] - tx-errors",
"Number of packets dropped when receiving [per second] - rx-drops",
"Number of packets dropped when sending [per second] - tx-drops",
}));
}
+6 -6
View File
@@ -27,9 +27,9 @@ void ffPrintOpenCL(FFOpenCLOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_OPENCL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OPENCL_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.version},
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.device},
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.version, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.device, "device"},
{FF_FORMAT_ARG_TYPE_STRBUF, &opencl.vendor, "vendor"},
}));
}
}
@@ -103,9 +103,9 @@ void ffGenerateOpenCLJsonResult(FF_MAYBE_UNUSED FFOpenCLOptions* options, yyjson
void ffPrintOpenCLHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_OPENCL_MODULE_NAME, "{1}", FF_OPENCL_NUM_FORMAT_ARGS, ((const char* []) {
"version",
"device",
"vendor"
"version - version",
"device - device",
"vendor - vendor"
}));
}
+8 -8
View File
@@ -29,10 +29,10 @@ void ffPrintOpenGL(FFOpenGLOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_OPENGL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OPENGL_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.renderer},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.slv},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.version, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.renderer, "renderer"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.slv, "slv"},
}));
}
@@ -161,10 +161,10 @@ void ffGenerateOpenGLJsonResult(FF_MAYBE_UNUSED FFOpenGLOptions* options, yyjson
void ffPrintOpenGLHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_OPENGL_MODULE_NAME, "{1}", FF_OPENGL_NUM_FORMAT_ARGS, ((const char* []) {
"version",
"renderer",
"vendor",
"shading language version"
"version - version",
"renderer - renderer",
"vendor - vendor",
"shading language version - slv"
}));
}
+24 -24
View File
@@ -112,18 +112,18 @@ void ffPrintOS(FFOSOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OS_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.systemName},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->prettyName},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->id},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->idLike},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->variant},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->variantID},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->version},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->versionID},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->codename},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->buildID},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.systemArchitecture}
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.systemName, "sysname"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->prettyName, "pretty-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->id, "id"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->idLike, "id-like"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->variant, "variant"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->variantID, "variant-id"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->version, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->versionID, "version-id"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->codename, "codename"},
{FF_FORMAT_ARG_TYPE_STRBUF, &os->buildID, "build-id"},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.systemArchitecture, "arch"}
}));
}
}
@@ -189,18 +189,18 @@ void ffGenerateOSJsonResult(FF_MAYBE_UNUSED FFOSOptions* options, yyjson_mut_doc
void ffPrintOSHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_OS_MODULE_NAME, "{3} {10} {12}", FF_OS_NUM_FORMAT_ARGS, ((const char* []) {
"Name of the kernel (Linux, WIN32_NT, Darwin, FreeBSD)",
"Name of the OS",
"Pretty name of the OS",
"ID of the OS",
"ID like of the OS",
"Variant of the OS",
"Variant ID of the OS",
"Version of the OS",
"Version ID of the OS",
"Version codename of the OS",
"Build ID of the OS",
"Architecture of the OS"
"Name of the kernel (Linux, WIN32_NT, Darwin, FreeBSD) - sysname",
"Name of the OS - name",
"Pretty name of the OS - pretty-name",
"ID of the OS - id",
"ID like of the OS - id-like",
"Variant of the OS - variant",
"Variant ID of the OS - variant-id",
"Version of the OS - version",
"Version ID of the OS - version-id",
"Version codename of the OS - codename",
"Build ID of the OS - build-id",
"Architecture of the OS - arch",
}));
}
+72 -72
View File
@@ -81,42 +81,42 @@ void ffPrintPackages(FFPackagesOptions* options)
uint32_t brewAll = counts.brew + counts.brewCask;
uint32_t guixAll = counts.guixSystem + counts.guixUser + counts.guixHome;
FF_PRINT_FORMAT_CHECKED(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PACKAGES_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &counts.all},
{FF_FORMAT_ARG_TYPE_UINT, &counts.pacman},
{FF_FORMAT_ARG_TYPE_STRBUF, &counts.pacmanBranch},
{FF_FORMAT_ARG_TYPE_UINT, &counts.dpkg},
{FF_FORMAT_ARG_TYPE_UINT, &counts.rpm},
{FF_FORMAT_ARG_TYPE_UINT, &counts.emerge},
{FF_FORMAT_ARG_TYPE_UINT, &counts.eopkg},
{FF_FORMAT_ARG_TYPE_UINT, &counts.xbps},
{FF_FORMAT_ARG_TYPE_UINT, &counts.nixSystem},
{FF_FORMAT_ARG_TYPE_UINT, &counts.nixUser},
{FF_FORMAT_ARG_TYPE_UINT, &counts.nixDefault},
{FF_FORMAT_ARG_TYPE_UINT, &counts.apk},
{FF_FORMAT_ARG_TYPE_UINT, &counts.pkg},
{FF_FORMAT_ARG_TYPE_UINT, &counts.flatpakSystem},
{FF_FORMAT_ARG_TYPE_UINT, &counts.flatpakUser},
{FF_FORMAT_ARG_TYPE_UINT, &counts.snap},
{FF_FORMAT_ARG_TYPE_UINT, &counts.brew},
{FF_FORMAT_ARG_TYPE_UINT, &counts.brewCask},
{FF_FORMAT_ARG_TYPE_UINT, &counts.macports},
{FF_FORMAT_ARG_TYPE_UINT, &counts.scoop},
{FF_FORMAT_ARG_TYPE_UINT, &counts.choco},
{FF_FORMAT_ARG_TYPE_UINT, &counts.pkgtool},
{FF_FORMAT_ARG_TYPE_UINT, &counts.paludis},
{FF_FORMAT_ARG_TYPE_UINT, &counts.winget},
{FF_FORMAT_ARG_TYPE_UINT, &counts.opkg},
{FF_FORMAT_ARG_TYPE_UINT, &counts.am},
{FF_FORMAT_ARG_TYPE_UINT, &counts.sorcery},
{FF_FORMAT_ARG_TYPE_UINT, &counts.lpkg},
{FF_FORMAT_ARG_TYPE_UINT, &counts.lpkgbuild},
{FF_FORMAT_ARG_TYPE_UINT, &counts.guixSystem},
{FF_FORMAT_ARG_TYPE_UINT, &counts.guixUser},
{FF_FORMAT_ARG_TYPE_UINT, &counts.guixHome},
{FF_FORMAT_ARG_TYPE_UINT, &nixAll},
{FF_FORMAT_ARG_TYPE_UINT, &flatpakAll},
{FF_FORMAT_ARG_TYPE_UINT, &brewAll},
{FF_FORMAT_ARG_TYPE_UINT, &guixAll},
{FF_FORMAT_ARG_TYPE_UINT, &counts.all, "all"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.pacman, "pacman"},
{FF_FORMAT_ARG_TYPE_STRBUF, &counts.pacmanBranch, "pacman-branch"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.dpkg, "dpkg"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.rpm, "rpm"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.emerge, "emerge"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.eopkg, "eopkg"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.xbps, "xbps"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.nixSystem, "nix-system"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.nixUser, "nix-user"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.nixDefault, "nix-default"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.apk, "apk"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.pkg, "pkg"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.flatpakSystem, "flatpak-system"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.flatpakUser, "flatpak-user"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.snap, "snap"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.brew, "brew"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.brewCask, "brew-cask"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.macports, "macports"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.scoop, "scoop"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.choco, "choco"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.pkgtool, "pkgtool"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.paludis, "paludis"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.winget, "winget"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.opkg, "opkg"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.am, "am"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.sorcery, "sorcery"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.lpkg, "lpkg"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.lpkgbuild, "lpkgbuild"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.guixSystem, "guix-system"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.guixUser, "guix-user"},
{FF_FORMAT_ARG_TYPE_UINT, &counts.guixHome, "guix-home"},
{FF_FORMAT_ARG_TYPE_UINT, &nixAll, "nix-all"},
{FF_FORMAT_ARG_TYPE_UINT, &flatpakAll, "flatpak-all"},
{FF_FORMAT_ARG_TYPE_UINT, &brewAll, "brew-all"},
{FF_FORMAT_ARG_TYPE_UINT, &guixAll, "guix-all"},
}));
}
@@ -412,42 +412,42 @@ void ffGeneratePackagesJsonResult(FF_MAYBE_UNUSED FFPackagesOptions* options, yy
void ffPrintPackagesHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PACKAGES_MODULE_NAME, "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (MacPorts), {20} (scoop), {21} (choco), {22} (pkgtool), {23} (paludis), {24} (winget), {25} (opkg), {26} (am), {27} (sorcery), {28} (lpkg), {29} (lpkgbuild), {30} (guix-system), {31} (guix-user), {32} (guix-home)", FF_PACKAGES_NUM_FORMAT_ARGS, ((const char* []) {
"Number of all packages",
"Number of pacman packages",
"Pacman branch on manjaro",
"Number of dpkg packages",
"Number of rpm packages",
"Number of emerge packages",
"Number of eopkg packages",
"Number of xbps packages",
"Number of nix-system packages",
"Number of nix-user packages",
"Number of nix-default packages",
"Number of apk packages",
"Number of pkg packages",
"Number of flatpak-system packages",
"Number of flatpak-user packages",
"Number of snap packages",
"Number of brew packages",
"Number of brew-cask packages",
"Number of macports packages",
"Number of scoop packages",
"Number of choco packages",
"Number of pkgtool packages",
"Number of paludis packages",
"Number of winget packages",
"Number of opkg packages",
"Number of am packages",
"Number of sorcery packages",
"Number of lpkg packages",
"Number of lpkgbuild packages",
"Number of guix-system packages",
"Number of guix-user packages",
"Number of guix-home packages",
"Total number of all nix packages",
"Total number of all flatpak packages",
"Total number of all brew packages",
"Total number of all guix packages",
"Number of all packages - all",
"Number of pacman packages - pacman",
"Pacman branch on manjaro - pacman-branch",
"Number of dpkg packages - dpkg",
"Number of rpm packages - rpm",
"Number of emerge packages - emerge",
"Number of eopkg packages - eopkg",
"Number of xbps packages - xbps",
"Number of nix-system packages - nix-system",
"Number of nix-user packages - nix-user",
"Number of nix-default packages - nix-default",
"Number of apk packages - apk",
"Number of pkg packages - pkg",
"Number of flatpak-system packages - flatpak-system",
"Number of flatpak-user packages - flatpak-user",
"Number of snap packages - snap",
"Number of brew packages - brew",
"Number of brew-cask packages - brew-cask",
"Number of macports packages - macports",
"Number of scoop packages - scoop",
"Number of choco packages - choco",
"Number of pkgtool packages - pkgtool",
"Number of paludis packages - paludis",
"Number of winget packages - winget",
"Number of opkg packages - opkg",
"Number of am packages - am",
"Number of sorcery packages - sorcery",
"Number of lpkg packages - lpkg",
"Number of lpkgbuild packages - lpkgbuild",
"Number of guix-system packages - guix-system",
"Number of guix-user packages - guix-user",
"Number of guix-home packages - guix-home",
"Total number of all nix packages - nix-all",
"Total number of all flatpak packages - flatpak-all",
"Total number of all brew packages - brew-all",
"Total number of all guix packages - guix-all",
}));
}
+14 -14
View File
@@ -24,9 +24,9 @@ static void formatKey(const FFPhysicalDiskOptions* options, FFPhysicalDiskResult
{
ffStrbufClear(key);
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 3, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &index},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath},
{FF_FORMAT_ARG_TYPE_UINT, &index, "index"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath, "dev-path"},
}));
}
}
@@ -108,16 +108,16 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options)
if (dev->type & FF_PHYSICALDISK_TYPE_READWRITE)
readOnlyType = "Read-write";
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_PHYSICALDISK_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->interconnect},
{FF_FORMAT_ARG_TYPE_STRING, physicalType},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->serial},
{FF_FORMAT_ARG_TYPE_STRING, removableType},
{FF_FORMAT_ARG_TYPE_STRING, readOnlyType},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->revision},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer, "size"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->interconnect, "interconnect"},
{FF_FORMAT_ARG_TYPE_STRING, physicalType, "type"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->devPath, "dev-path"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->serial, "serial"},
{FF_FORMAT_ARG_TYPE_STRING, removableType, "removable-type"},
{FF_FORMAT_ARG_TYPE_STRING, readOnlyType, "readonly-type"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dev->revision, "revision"},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"},
}));
}
++index;
@@ -252,7 +252,7 @@ void ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut
void ffPrintPhysicalDiskHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PHYSICALDISK_MODULE_NAME, "{1} [{6}, {7}, {8}]", FF_PHYSICALDISK_NUM_FORMAT_ARGS, ((const char* []) {
"Device size (formatted)",
"Device size (formatted) - ",
"Device name",
"Device interconnect type",
"Device raw file path",
+22 -22
View File
@@ -54,17 +54,17 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PHYSICALMEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_UINT64, &device->size},
{FF_FORMAT_ARG_TYPE_STRBUF, &prettySize},
{FF_FORMAT_ARG_TYPE_UINT, &device->maxSpeed},
{FF_FORMAT_ARG_TYPE_UINT, &device->runningSpeed},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->type},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->formFactor},
{FF_FORMAT_ARG_TYPE_DOUBLE, &device->locator},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->vendor},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->serial},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->partNumber},
{FF_FORMAT_ARG_TYPE_BOOL, &device->ecc},
{FF_FORMAT_ARG_TYPE_UINT64, &device->size, "bytes"},
{FF_FORMAT_ARG_TYPE_STRBUF, &prettySize, "size"},
{FF_FORMAT_ARG_TYPE_UINT, &device->maxSpeed, "max-speed"},
{FF_FORMAT_ARG_TYPE_UINT, &device->runningSpeed, "running-speed"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->type, "type"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->formFactor, "form-factor"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &device->locator, "locator"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->serial, "serial"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->partNumber, "part-number"},
{FF_FORMAT_ARG_TYPE_BOOL, &device->ecc, "is-ecc-enabled"},
}));
}
}
@@ -156,17 +156,17 @@ void ffGeneratePhysicalMemoryJsonResult(FF_MAYBE_UNUSED FFPhysicalMemoryOptions*
void ffPrintPhysicalMemoryHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PHYSICALMEMORY_MODULE_NAME, "{7} {5}-{3}: {2}, running at {4} MT/s", FF_PHYSICALMEMORY_NUM_FORMAT_ARGS, ((const char* []) {
"Size (in bytes)",
"Size formatted",
"Max speed (in MT/s)",
"Running speed (in MT/s)",
"Type (DDR4, DDR5, etc.)",
"Form factor (SODIMM, DIMM, etc.)",
"Bank/Device Locator (BANK0/SIMM0, BANK0/SIMM1, etc.)",
"Vendor",
"Serial number",
"Part number",
"ECC enabled",
"Size (in bytes) - bytes",
"Size formatted - size",
"Max speed (in MT/s) - max-speed",
"Running speed (in MT/s) - running-speed",
"Type (DDR4, DDR5, etc.) - type",
"Form factor (SODIMM, DIMM, etc.) - form-factor",
"Bank/Device Locator (BANK0/SIMM0, BANK0/SIMM1, etc.) - locator",
"Vendor - vendor",
"Serial number - serial",
"Part number - part-number",
"True if ECC enabled - is-ecc-enabled",
}));
}
+8 -8
View File
@@ -65,10 +65,10 @@ void ffPrintPlayer(FFPlayerOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_PLAYER_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PLAYER_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &playerPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->player},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->playerId},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->url}
{FF_FORMAT_ARG_TYPE_STRBUF, &playerPretty, "player"},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->player, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->playerId, "id"},
{FF_FORMAT_ARG_TYPE_STRBUF, &media->url, "url"}
}));
}
}
@@ -127,10 +127,10 @@ void ffGeneratePlayerJsonResult(FF_MAYBE_UNUSED FFMediaOptions* options, yyjson_
void ffPrintPlayerHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PLAYER_MODULE_NAME, "{1}", FF_PLAYER_NUM_FORMAT_ARGS, ((const char* []) {
"Pretty player name",
"Player name",
"Player Identifier",
"URL name"
"Pretty player name - player",
"Player name - name",
"Player Identifier - id",
"URL name - url",
}));
}
+12 -12
View File
@@ -39,12 +39,12 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_POWERADAPTER_DISPLAY_NAME, i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_POWERADAPTER_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_INT, &result->watts},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->description},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->serial},
{FF_FORMAT_ARG_TYPE_INT, &result->watts, "watts"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer, "manufacturer"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName, "model-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->description, "description"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->serial, "serial"},
}));
}
@@ -129,12 +129,12 @@ void ffGeneratePowerAdapterJsonResult(FF_MAYBE_UNUSED FFPowerAdapterOptions* opt
void ffPrintPowerAdapterHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_POWERADAPTER_MODULE_NAME, "{1}W", FF_POWERADAPTER_NUM_FORMAT_ARGS, ((const char* []) {
"PowerAdapter watts",
"PowerAdapter name",
"PowerAdapter manufacturer",
"PowerAdapter model",
"PowerAdapter description",
"PowerAdapter serial number",
"PowerAdapter watts - watts",
"PowerAdapter name - name",
"PowerAdapter manufacturer - manufacturer",
"PowerAdapter model - model",
"PowerAdapter description - description",
"PowerAdapter serial number - serial",
}));
}
+2 -2
View File
@@ -26,7 +26,7 @@ void ffPrintProcesses(FFProcessesOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_PROCESSES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PROCESSES_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &numProcesses}
{FF_FORMAT_ARG_TYPE_UINT, &numProcesses, "result"}
}));
}
}
@@ -83,7 +83,7 @@ void ffGenerateProcessesJsonResult(FF_MAYBE_UNUSED FFProcessesOptions* options,
void ffPrintProcessesHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PROCESSES_MODULE_NAME, "{1}", FF_PROCESSES_NUM_FORMAT_ARGS, (const char* []) {
"Count"
"Proecess count - result"
});
}
+4 -4
View File
@@ -31,8 +31,8 @@ void ffPrintPublicIp(FFPublicIpOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_PUBLICIP_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PUBLICIP_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &result.ip},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.location},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.ip, "ip"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result.location, "location"},
}));
}
@@ -144,8 +144,8 @@ void ffGeneratePublicIpJsonResult(FFPublicIpOptions* options, yyjson_mut_doc* do
void ffPrintPublicIpHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PUBLICIP_MODULE_NAME, "{1} ({2})", FF_PUBLICIP_NUM_FORMAT_ARGS, ((const char* []) {
"Public IP address",
"Location"
"Public IP address - ip",
"Location - location",
}));
}
+16 -16
View File
@@ -32,14 +32,14 @@ void ffPrintShell(FFShellOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_SHELL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SHELL_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &result->processName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exe},
{FF_FORMAT_ARG_TYPE_STRING, result->exeName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->version},
{FF_FORMAT_ARG_TYPE_UINT, &result->pid},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath},
{FF_FORMAT_ARG_TYPE_INT, &result->tty},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->processName, "process-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exe, "exe"},
{FF_FORMAT_ARG_TYPE_STRING, result->exeName, "exe-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->version, "version"},
{FF_FORMAT_ARG_TYPE_UINT, &result->pid, "pid"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName, "pretty-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath, "exe-path"},
{FF_FORMAT_ARG_TYPE_INT, &result->tty, "tty"},
}));
}
}
@@ -107,14 +107,14 @@ void ffGenerateShellJsonResult(FF_MAYBE_UNUSED FFShellOptions* options, yyjson_m
void ffPrintShellHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_SHELL_MODULE_NAME, "{3} {4}", FF_SHELL_NUM_FORMAT_ARGS, ((const char* []) {
"Shell process name",
"The first argument of the command line when running the shell",
"Shell base name of arg0",
"Shell version",
"Shell pid",
"Shell pretty name",
"Shell full exe path",
"Shell tty used",
"Shell process name - process-name",
"The first argument of the command line when running the shell - exe",
"Shell base name of arg0 - exe-name",
"Shell version - version",
"Shell pid - pid",
"Shell pretty name - pretty-name",
"Shell full exe path - exe-path",
"Shell tty used - tty",
}));
}
+8 -8
View File
@@ -50,10 +50,10 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui
ffPercentAppendNum(&percentageStr, device->volume, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_SOUND_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SOUND_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_BOOL, &device->main},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->identifier}
{FF_FORMAT_ARG_TYPE_BOOL, &device->main, "is-main"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr, "volume-percentage"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->identifier, "identifier"},
}));
}
}
@@ -226,10 +226,10 @@ void ffGenerateSoundJsonResult(FF_MAYBE_UNUSED FFSoundOptions* options, yyjson_m
void ffPrintSoundHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_SOUND_MODULE_NAME, "{2} ({3}%)", FF_SOUND_NUM_FORMAT_ARGS, ((const char* []) {
"Is main sound device",
"Device name",
"Volume",
"Identifier"
"Is main sound device - is-main",
"Device name - name",
"Volume (in percentage) - volume-percentage",
"Identifier - identifier",
}));
}
+6 -6
View File
@@ -68,9 +68,9 @@ void ffPrintSwap(FFSwapOptions* options)
FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate();
ffPercentAppendNum(&percentageStr, percentage, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SWAP_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "used"},
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "total"},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr, "percentage"},
}));
}
}
@@ -137,9 +137,9 @@ void ffGenerateSwapJsonResult(FF_MAYBE_UNUSED FFSwapOptions* options, yyjson_mut
void ffPrintSwapHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_SWAP_MODULE_NAME, "{1} / {2} ({3})", FF_SWAP_NUM_FORMAT_ARGS, ((const char* []) {
"Used size",
"Total size",
"Percentage used"
"Used size - used",
"Total size - total",
"Percentage used - percentage",
}));
}
+16 -16
View File
@@ -30,14 +30,14 @@ void ffPrintTerminal(FFTerminalOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_TERMINAL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINAL_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &result->processName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exe},
{FF_FORMAT_ARG_TYPE_STRING, result->exeName},
{FF_FORMAT_ARG_TYPE_UINT, &result->pid},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->version},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->tty},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->processName, "process-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exe, "exe"},
{FF_FORMAT_ARG_TYPE_STRING, result->exeName, "exe-name"},
{FF_FORMAT_ARG_TYPE_UINT, &result->pid, "pid"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->prettyName, "pretty-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->version, "version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->exePath, "exe-path"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->tty, "tty"},
}));
}
}
@@ -102,14 +102,14 @@ void ffGenerateTerminalJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options, yy
void ffPrintTerminalHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TERMINAL_MODULE_NAME, "{5} {6}", FF_TERMINAL_NUM_FORMAT_ARGS, ((const char* []) {
"Terminal process name",
"The first argument of the command line when running the terminal",
"Terminal base name of arg0",
"Terminal pid",
"Terminal pretty name",
"Terminal version",
"Terminal full exe path",
"Terminal tty / pts used",
"Terminal process name - process-name",
"The first argument of the command line when running the terminal - exe",
"Terminal base name of arg0 - exe-name",
"Terminal pid - pid",
"Terminal pretty name - pretty-name",
"Terminal version - version",
"Terminal full exe path - exe-path",
"Terminal tty / pts used - tty",
}));
}
+8 -8
View File
@@ -34,10 +34,10 @@ void ffPrintTerminalFont(FFTerminalFontOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALFONT_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.pretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.name},
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.size},
{FF_FORMAT_ARG_TYPE_LIST, &terminalFont.font.styles}
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.pretty, "combined"},
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.size, "size"},
{FF_FORMAT_ARG_TYPE_LIST, &terminalFont.font.styles, "styles"},
}));
}
}
@@ -124,10 +124,10 @@ void ffGenerateTerminalFontJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options
void ffPrintTerminalFontHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TERMINALFONT_MODULE_NAME, "{1}", FF_TERMINALFONT_NUM_FORMAT_ARGS, ((const char* []) {
"Terminal font combined",
"Terminal font name",
"Terminal font size",
"Terminal font styles"
"Terminal font combined - combined",
"Terminal font name - name",
"Terminal font size - size",
"Terminal font styles - styles",
}));
}
+8 -8
View File
@@ -30,10 +30,10 @@ void ffPrintTerminalSize(FFTerminalSizeOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_TERMINALSIZE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALSIZE_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT16, &result.rows},
{FF_FORMAT_ARG_TYPE_UINT16, &result.columns},
{FF_FORMAT_ARG_TYPE_UINT16, &result.width},
{FF_FORMAT_ARG_TYPE_UINT16, &result.height}
{FF_FORMAT_ARG_TYPE_UINT16, &result.rows, "rows"},
{FF_FORMAT_ARG_TYPE_UINT16, &result.columns, "columns"},
{FF_FORMAT_ARG_TYPE_UINT16, &result.width, "width"},
{FF_FORMAT_ARG_TYPE_UINT16, &result.height, "height"},
}));
}
}
@@ -94,10 +94,10 @@ void ffGenerateTerminalSizeJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options
void ffPrintTerminalSizeHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TERMINALSIZE_MODULE_NAME, "{1} columns x {2} rows ({3}px x {4}px)", FF_TERMINALSIZE_NUM_FORMAT_ARGS, ((const char* []) {
"Terminal rows",
"Terminal columns",
"Terminal width (in pixels)",
"Terminal height (in pixels)"
"Terminal rows - rows",
"Terminal columns - columns",
"Terminal width (in pixels) - width",
"Terminal height (in pixels) - height",
}));
}
+8 -8
View File
@@ -33,10 +33,10 @@ void ffPrintTerminalTheme(FFTerminalThemeOptions* options)
snprintf(fg, sizeof(fg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.fg.r, result.fg.g, result.fg.b);
snprintf(bg, sizeof(bg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.bg.r, result.bg.g, result.bg.b);
FF_PRINT_FORMAT_CHECKED(FF_TERMINALTHEME_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALTHEME_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRING, fg},
{FF_FORMAT_ARG_TYPE_STRING, result.fg.dark ? "Dark" : "Light"},
{FF_FORMAT_ARG_TYPE_STRING, bg},
{FF_FORMAT_ARG_TYPE_STRING, result.bg.dark ? "Dark" : "Light"},
{FF_FORMAT_ARG_TYPE_STRING, fg, "fg-color"},
{FF_FORMAT_ARG_TYPE_STRING, result.fg.dark ? "Dark" : "Light", "fg-type"},
{FF_FORMAT_ARG_TYPE_STRING, bg, "bg-color"},
{FF_FORMAT_ARG_TYPE_STRING, result.bg.dark ? "Dark" : "Light", "bg-type"},
}));
}
}
@@ -105,10 +105,10 @@ void ffGenerateTerminalThemeJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* option
void ffPrintTerminalThemeHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TERMINALTHEME_MODULE_NAME, "{1} (FG) {3} (BG) [{4}]", FF_TERMINALTHEME_NUM_FORMAT_ARGS, ((const char* []) {
"Terminal foreground color",
"Terminal foreground type (Dark / Light)",
"Terminal background color",
"Terminal background type (Dark / Light)",
"Terminal foreground color - fg-color",
"Terminal foreground type (Dark / Light) - fg-type",
"Terminal background color - bg-color",
"Terminal background type (Dark / Light) - bg-type",
}));
}
+2 -2
View File
@@ -25,7 +25,7 @@ void ffPrintTheme(FFThemeOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_THEME_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_THEME_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &theme}
{FF_FORMAT_ARG_TYPE_STRBUF, &theme, "combined"},
}));
}
}
@@ -82,7 +82,7 @@ void ffGenerateThemeJsonResult(FF_MAYBE_UNUSED FFThemeOptions* options, yyjson_m
void ffPrintThemeHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_THEME_MODULE_NAME, "{1}", FF_THEME_NUM_FORMAT_ARGS, ((const char* []) {
"Combined themes"
"Combined themes - combined",
}));
}
+16 -16
View File
@@ -57,14 +57,14 @@ void ffPrintTitle(FFTitleOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_TITLE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TITLE_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.userName},
{FF_FORMAT_ARG_TYPE_STRBUF, &hostName},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.homeDir},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.exePath},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.userShell},
{FF_FORMAT_ARG_TYPE_STRBUF, &userNameColored},
{FF_FORMAT_ARG_TYPE_STRBUF, &atColored},
{FF_FORMAT_ARG_TYPE_STRBUF, &hostNameColored},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.userName, "user-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &hostName, "host-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.homeDir, "home-dir"},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.exePath, "exe-path"},
{FF_FORMAT_ARG_TYPE_STRBUF, &instance.state.platform.userShell, "user-shell"},
{FF_FORMAT_ARG_TYPE_STRBUF, &userNameColored, "user-name-colored"},
{FF_FORMAT_ARG_TYPE_STRBUF, &atColored, "at-symbol-colored"},
{FF_FORMAT_ARG_TYPE_STRBUF, &hostNameColored, "host-name-colored"},
}));
}
}
@@ -182,14 +182,14 @@ void ffGenerateTitleJsonResult(FF_MAYBE_UNUSED FFTitleOptions* options, yyjson_m
void ffPrintTitleHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TITLE_MODULE_NAME, "{6}{7}{8}", FF_TITLE_NUM_FORMAT_ARGS, ((const char* []) {
"User name",
"Host name",
"Home directory",
"Executable path of current process",
"User's default shell",
"User name (colored)",
"@ symbol (colored)",
"Host name (colored)"
"User name - user-name",
"Host name - host-name",
"Home directory - home-dir",
"Executable path of current process - exe-path",
"User's default shell - user-shell",
"User name (colored) - user-name-colored",
"@ symbol (colored) - at-symbol-colored",
"Host name (colored) - host-name-colored",
}));
}
+12 -12
View File
@@ -79,12 +79,12 @@ void ffPrintUptime(FFUptimeOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_UPTIME_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_UPTIME_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &days},
{FF_FORMAT_ARG_TYPE_UINT, &hours},
{FF_FORMAT_ARG_TYPE_UINT, &minutes},
{FF_FORMAT_ARG_TYPE_UINT, &seconds},
{FF_FORMAT_ARG_TYPE_UINT, &milliseconds},
{FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(result.uptime)},
{FF_FORMAT_ARG_TYPE_UINT, &days, "days"},
{FF_FORMAT_ARG_TYPE_UINT, &hours, "hours"},
{FF_FORMAT_ARG_TYPE_UINT, &minutes, "minutes"},
{FF_FORMAT_ARG_TYPE_UINT, &seconds, "seconds"},
{FF_FORMAT_ARG_TYPE_UINT, &milliseconds, "milliseconds"},
{FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(result.uptime), "boot-time"},
}));
}
}
@@ -143,12 +143,12 @@ void ffGenerateUptimeJsonResult(FF_MAYBE_UNUSED FFUptimeOptions* options, yyjson
void ffPrintUptimeHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_UPTIME_MODULE_NAME, "{1} days {2} hours {3} mins", FF_UPTIME_NUM_FORMAT_ARGS, ((const char* []) {
"Days",
"Hours",
"Minutes",
"Seconds",
"Milliseconds",
"Boot time in local timezone",
"Days - days",
"Hours - hours",
"Minutes - minutes",
"Seconds - seconds",
"Milliseconds - milliseconds",
"Boot time in local timezone - boot-time",
}));
}
+10 -10
View File
@@ -69,11 +69,11 @@ void ffPrintUsers(FFUsersOptions* options)
FFUserResult* user = (FFUserResult*)ffListGet(&users, i);
FF_PRINT_FORMAT_CHECKED(FF_USERS_MODULE_NAME, users.length == 1 ? 0 : (uint8_t) (i + 1), &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_USERS_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &user->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &user->hostName},
{FF_FORMAT_ARG_TYPE_STRBUF, &user->sessionName},
{FF_FORMAT_ARG_TYPE_STRBUF, &user->clientIp},
{FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(user->loginTime)},
{FF_FORMAT_ARG_TYPE_STRBUF, &user->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &user->hostName, "host-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &user->sessionName, "session-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &user->clientIp, "client-ip"},
{FF_FORMAT_ARG_TYPE_STRING, ffTimeToShortStr(user->loginTime), "login-time"},
}));
}
}
@@ -176,11 +176,11 @@ void ffGenerateUsersJsonResult(FF_MAYBE_UNUSED FFUsersOptions* options, yyjson_m
void ffPrintUsersHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_USERS_MODULE_NAME, "{1}@{2} - login time {5}", FF_USERS_NUM_FORMAT_ARGS, ((const char* []) {
"User name",
"Host name",
"Session name",
"Client IP",
"Login Time in local timezone"
"User name - user-name",
"Host name - host-name",
"Session name - session",
"Client IP - client-ip",
"Login Time in local timezone - login-time",
}));
}
+18 -18
View File
@@ -32,15 +32,15 @@ void ffPrintVersion(FFVersionOptions* options)
}
FF_PRINT_FORMAT_CHECKED(FF_VERSION_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_VERSION_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRING, result.projectName},
{FF_FORMAT_ARG_TYPE_STRING, result.version},
{FF_FORMAT_ARG_TYPE_STRING, result.versionTweak},
{FF_FORMAT_ARG_TYPE_STRING, result.debugMode ? "debug" : "release"},
{FF_FORMAT_ARG_TYPE_STRING, result.architecture},
{FF_FORMAT_ARG_TYPE_STRING, result.cmakeBuiltType},
{FF_FORMAT_ARG_TYPE_STRING, result.compileTime},
{FF_FORMAT_ARG_TYPE_STRING, result.compiler},
{FF_FORMAT_ARG_TYPE_STRBUF, &buf},
{FF_FORMAT_ARG_TYPE_STRING, result.projectName, "project-name"},
{FF_FORMAT_ARG_TYPE_STRING, result.version, "version"},
{FF_FORMAT_ARG_TYPE_STRING, result.versionTweak, "version-tweak"},
{FF_FORMAT_ARG_TYPE_STRING, result.debugMode ? "debug" : "release", "build-type"},
{FF_FORMAT_ARG_TYPE_STRING, result.architecture, "arch"},
{FF_FORMAT_ARG_TYPE_STRING, result.cmakeBuiltType, "cmake-built-type"},
{FF_FORMAT_ARG_TYPE_STRING, result.compileTime, "compile-time"},
{FF_FORMAT_ARG_TYPE_STRING, result.compiler, "compiler"},
{FF_FORMAT_ARG_TYPE_STRBUF, &buf, "libc-used"},
}));
}
}
@@ -115,15 +115,15 @@ void ffGenerateVersionJsonResult(FF_MAYBE_UNUSED FFVersionOptions* options, yyjs
void ffPrintVersionHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_VERSION_MODULE_NAME, "{1} {2}{3} ({5})", FF_VERSION_NUM_FORMAT_ARGS, ((const char* []) {
"Project name",
"Version",
"Version tweak",
"Build type (debug or release)",
"Architecture",
"CMake build type (Debug, Release, RelWithDebInfo, MinSizeRel)",
"Date time when compiling",
"Compiler used",
"Libc used"
"Project name - name",
"Version - version",
"Version tweak - version-tweak",
"Build type (debug or release) - build-type",
"Architecture - arch",
"CMake build type when compiling (Debug, Release, RelWithDebInfo, MinSizeRel) - cmake-built-type",
"Date time when compiling - compile-time",
"Compiler used when compiling - compiler",
"Libc used when compiling - libc",
}));
}
+8 -8
View File
@@ -44,10 +44,10 @@ void ffPrintVulkan(FFVulkanOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_VULKAN_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_VULKAN_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->driver},
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->apiVersion},
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->conformanceVersion},
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->instanceVersion},
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->driver, "driver"},
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->apiVersion, "api-version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->conformanceVersion, "conformance-version"},
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->instanceVersion, "instance-version"},
}));
}
}
@@ -146,10 +146,10 @@ void ffGenerateVulkanJsonResult(FF_MAYBE_UNUSED FFVulkanOptions* options, yyjson
void ffPrintVulkanHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_VULKAN_MODULE_NAME, "{2} - {1}", FF_VULKAN_NUM_FORMAT_ARGS, ((const char* []) {
"Driver name",
"API version",
"Conformance version",
"Instance version",
"Driver name - driver",
"API version - api-version",
"Conformance version - conformance-version",
"Instance version - instance-version",
}));
}
+4 -4
View File
@@ -36,8 +36,8 @@ void ffPrintWallpaper(FFWallpaperOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_WALLPAPER_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WALLPAPER_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRING, filename},
{FF_FORMAT_ARG_TYPE_STRBUF, &fullpath},
{FF_FORMAT_ARG_TYPE_STRING, filename, "file-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &fullpath, "full-path"},
}));
}
}
@@ -92,8 +92,8 @@ void ffGenerateWallpaperJsonResult(FF_MAYBE_UNUSED FFWallpaperOptions* options,
void ffPrintWallpaperHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_WALLPAPER_MODULE_NAME, "{1}", FF_WALLPAPER_NUM_FORMAT_ARGS, ((const char* []) {
"File name",
"Full path",
"File name - file-name",
"Full path - full-path",
}));
}
+2 -2
View File
@@ -26,7 +26,7 @@ void ffPrintWeather(FFWeatherOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_WEATHER_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WEATHER_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &result}
{FF_FORMAT_ARG_TYPE_STRBUF, &result, "result"},
}));
}
}
@@ -128,7 +128,7 @@ void ffGenerateWeatherJsonResult(FFWeatherOptions* options, yyjson_mut_doc* doc,
void ffPrintWeatherHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_WEATHER_MODULE_NAME, "{1}", FF_WEATHER_NUM_FORMAT_ARGS, ((const char* []) {
"Weather result"
"Weather result - result",
}));
}
+20 -20
View File
@@ -47,16 +47,16 @@ void ffPrintWifi(FFWifiOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_WIFI_MODULE_NAME, moduleIndex, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WIFI_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &item->inf.description},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->inf.status},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.status},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.ssid},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.macAddress},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.protocol},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->conn.signalQuality},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->conn.rxRate},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->conn.txRate},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.security},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->inf.description, "inf-desc"},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->inf.status, "inf-status"},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.status, "status"},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.ssid, "ssid"},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.macAddress, "mac-address"},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.protocol, "protocol"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->conn.signalQuality, "signal-quality"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->conn.rxRate, "rx-rate"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &item->conn.txRate, "tx-rate"},
{FF_FORMAT_ARG_TYPE_STRBUF, &item->conn.security, "security"},
}));
}
@@ -150,16 +150,16 @@ void ffGenerateWifiJsonResult(FF_MAYBE_UNUSED FFWifiOptions* options, yyjson_mut
void ffPrintWifiHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_WIFI_MODULE_NAME, "{4} - {10}", FF_WIFI_NUM_FORMAT_ARGS, ((const char* []) {
"Interface description",
"Interface status",
"Connection status",
"Connection SSID",
"Connection BSSID",
"Connection protocol",
"Connection signal quality (percentage)",
"Connection RX rate",
"Connection TX rate",
"Connection Security algorithm"
"Interface description - inf-desc",
"Interface status - inf-status",
"Connection status - status",
"Connection SSID - ssid",
"Connection BSSID - bssid",
"Connection protocol - protocol",
"Connection signal quality (percentage) - signal-quality",
"Connection RX rate - rx-rate",
"Connection TX rate - tx-rate",
"Connection Security algorithm - security",
}));
}
+8 -8
View File
@@ -46,10 +46,10 @@ void ffPrintWM(FFWMOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_WM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WM_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &result->wmProcessName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->wmPrettyName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->wmProtocolName},
{FF_FORMAT_ARG_TYPE_STRBUF, &pluginName},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->wmProcessName, "process-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->wmPrettyName, "pretty-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->wmProtocolName, "protocol-name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &pluginName, "plugin-name"},
}));
}
}
@@ -128,10 +128,10 @@ void ffGenerateWMJsonResult(FF_MAYBE_UNUSED FFWMOptions* options, yyjson_mut_doc
void ffPrintWMHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_WM_MODULE_NAME, "{2} ({3})", FF_WM_NUM_FORMAT_ARGS, ((const char* []) {
"WM process name",
"WM pretty name",
"WM protocol name",
"WM plugin name"
"WM process name - process-name",
"WM pretty name - pretty-name",
"WM protocol name - protocol-name",
"WM plugin name - plugin-name",
}));
}
+2 -2
View File
@@ -20,7 +20,7 @@ void ffPrintWMTheme(FFWMThemeOptions* options)
else
{
FF_PRINT_FORMAT_CHECKED(FF_WMTHEME_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_WMTHEME_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &themeOrError}
{FF_FORMAT_ARG_TYPE_STRBUF, &themeOrError, "result"},
}));
}
}
@@ -80,7 +80,7 @@ void ffGenerateWMThemeJsonResult(FF_MAYBE_UNUSED FFWMThemeOptions* options, yyjs
void ffPrintWMthemeHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_WMTHEME_MODULE_NAME, "{1}", FF_WMTHEME_NUM_FORMAT_ARGS, ((const char* []) {
"WM theme"
"WM theme - result",
}));
}