Modules: remove all parseCommandOptions and related stuff

This commit is contained in:
李通洲
2025-08-03 09:26:17 +08:00
parent 22bfaf3c69
commit 094d736d38
77 changed files with 15 additions and 1536 deletions
-12
View File
@@ -10,18 +10,6 @@
#include <ctype.h>
#include <inttypes.h>
bool ffParseModuleOptions(const char* key, const char* value)
{
if (!ffStrStartsWith(key, "--") || !ffCharIsEnglishAlphabet(key[2])) return false;
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(key[2]) - 'A']; *modules; ++modules)
{
FFModuleBaseInfo* baseInfo = *modules;
if (baseInfo->parseCommandOptions(baseInfo, key, value)) return true;
}
return false;
}
void ffPrepareCommandOption(FFdata* data)
{
FFOptionsModules* const options = &instance.config.modules;
-1
View File
@@ -9,7 +9,6 @@ typedef struct FFdata
bool configLoaded;
} FFdata;
bool ffParseModuleOptions(const char* key, const char* value);
void ffPrepareCommandOption(FFdata* data);
void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc);
void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc);
-1
View File
@@ -29,7 +29,6 @@ typedef struct FFModuleBaseInfo
// This is UB, because `void*` is not compatible with `FF*Options*`.
// However we can't do it better unless we move to C++, so that `option` becomes a `this` pointer
// https://stackoverflow.com/questions/559581/casting-a-function-pointer-to-another-type
bool (*parseCommandOptions)(void* options, const char* key, const char* value);
void (*parseJsonObject)(void* options, struct yyjson_val *module);
void (*printModule)(void* options);
void (*generateJsonResult)(void* options, struct yyjson_mut_doc* doc, struct yyjson_mut_val* module);
+1 -2
View File
@@ -644,8 +644,7 @@ static void parseOption(FFdata* data, const char* key, const char* value)
else if(
ffOptionsParseGeneralCommandLine(&instance.config.general, key, value) ||
ffOptionsParseLogoCommandLine(&instance.config.logo, key, value) ||
ffOptionsParseDisplayCommandLine(&instance.config.display, key, value) ||
ffParseModuleOptions(key, value)
ffOptionsParseDisplayCommandLine(&instance.config.display, key, value)
) {}
else
-25
View File
@@ -159,30 +159,6 @@ void ffPrintBattery(FFBatteryOptions* options)
}
}
bool ffParseBatteryCommandOptions(FFBatteryOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_BATTERY_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffTempsParseCommandOptions(key, subKey, value, &options->temp, &options->tempConfig))
return true;
#ifdef _WIN32
if (ffStrEqualsIgnCase(subKey, "use-setup-api"))
{
options->useSetupApi = ffOptionParseBoolean(value);
return true;
}
#endif
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseBatteryJsonObject(FFBatteryOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -272,7 +248,6 @@ void ffGenerateBatteryJsonResult(FFBatteryOptions* options, yyjson_mut_doc* doc,
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BATTERY_MODULE_NAME,
.description = "Print battery capacity, status, etc",
.parseCommandOptions = (void*) ffParseBatteryCommandOptions,
.parseJsonObject = (void*) ffParseBatteryJsonObject,
.printModule = (void*) ffPrintBattery,
.generateJsonResult = (void*) ffGenerateBatteryJsonResult,
-11
View File
@@ -75,16 +75,6 @@ exit:
ffStrbufDestroy(&bios.type);
}
bool ffParseBiosCommandOptions(FFBiosOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_BIOS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseBiosJsonObject(FFBiosOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -141,7 +131,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BIOS_MODULE_NAME,
.description = "Print information of 1st-stage bootloader (name, version, release date, etc)",
.parseCommandOptions = (void*) ffParseBiosCommandOptions,
.parseJsonObject = (void*) ffParseBiosJsonObject,
.printModule = (void*) ffPrintBios,
.generateJsonResult = (void*) ffGenerateBiosJsonResult,
-20
View File
@@ -97,25 +97,6 @@ void ffPrintBluetooth(FFBluetoothOptions* options)
}
}
bool ffParseBluetoothCommandOptions(FFBluetoothOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_BLUETOOTH_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "show-disconnected"))
{
options->showDisconnected = ffOptionParseBoolean(value);
return true;
}
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseBluetoothJsonObject(FFBluetoothOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -185,7 +166,6 @@ void ffGenerateBluetoothJsonResult(FFBluetoothOptions* options, yyjson_mut_doc*
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BLUETOOTH_MODULE_NAME,
.description = "List (connected) bluetooth devices",
.parseCommandOptions = (void*) ffParseBluetoothCommandOptions,
.parseJsonObject = (void*) ffParseBluetoothJsonObject,
.printModule = (void*) ffPrintBluetooth,
.generateJsonResult = (void*) ffGenerateBluetoothJsonResult,
@@ -105,16 +105,6 @@ void ffPrintBluetoothRadio(FFBluetoothRadioOptions* options)
}
}
bool ffParseBluetoothRadioCommandOptions(FFBluetoothRadioOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_BLUETOOTHRADIO_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseBluetoothRadioJsonObject(FFBluetoothRadioOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -179,7 +169,6 @@ void ffGenerateBluetoothRadioJsonResult(FF_MAYBE_UNUSED FFBluetoothRadioOptions*
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BLUETOOTHRADIO_MODULE_NAME,
.description = "List bluetooth radios width supported version and vendor",
.parseCommandOptions = (void*) ffParseBluetoothRadioCommandOptions,
.parseJsonObject = (void*) ffParseBluetoothRadioJsonObject,
.printModule = (void*) ffPrintBluetoothRadio,
.generateJsonResult = (void*) ffGenerateBluetoothRadioJsonResult,
-11
View File
@@ -50,16 +50,6 @@ exit:
ffStrbufDestroy(&result.serial);
}
bool ffParseBoardCommandOptions(FFBoardOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_BOARD_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseBoardJsonObject(FFBoardOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -119,7 +109,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BOARD_MODULE_NAME,
.description = "Print motherboard name and other info",
.parseCommandOptions = (void*) ffParseBoardCommandOptions,
.parseJsonObject = (void*) ffParseBoardJsonObject,
.printModule = (void*) ffPrintBoard,
.generateJsonResult = (void*) ffGenerateBoardJsonResult,
-11
View File
@@ -50,16 +50,6 @@ void ffPrintBootmgr(FFBootmgrOptions* options)
ffStrbufDestroy(&bootmgr.firmware);
}
bool ffParseBootmgrCommandOptions(FFBootmgrOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_BOOTMGR_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseBootmgrJsonObject(FFBootmgrOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -110,7 +100,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BOOTMGR_MODULE_NAME,
.description = "Print information of 2nd-stage bootloader (name, firmware, etc)",
.parseCommandOptions = (void*) ffParseBootmgrCommandOptions,
.parseJsonObject = (void*) ffParseBootmgrJsonObject,
.printModule = (void*) ffPrintBootmgr,
.generateJsonResult = (void*) ffGenerateBootmgrJsonResult,
-6
View File
@@ -8,11 +8,6 @@ void ffPrintBreak(FF_MAYBE_UNUSED FFBreakOptions* options)
putchar('\n');
}
bool ffParseBreakCommandOptions(FF_MAYBE_UNUSED FFBreakOptions* options, FF_MAYBE_UNUSED const char* key, FF_MAYBE_UNUSED const char* value)
{
return false;
}
void ffParseBreakJsonObject(FF_MAYBE_UNUSED FFBreakOptions* options, FF_MAYBE_UNUSED yyjson_val* module)
{
yyjson_val *key, *val;
@@ -29,7 +24,6 @@ void ffParseBreakJsonObject(FF_MAYBE_UNUSED FFBreakOptions* options, FF_MAYBE_UN
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BREAK_MODULE_NAME,
.description = "Print a empty line",
.parseCommandOptions = (void*) ffParseBreakCommandOptions,
.parseJsonObject = (void*) ffParseBreakJsonObject,
.printModule = (void*) ffPrintBreak,
};
-26
View File
@@ -112,31 +112,6 @@ void ffPrintBrightness(FFBrightnessOptions* options)
}
}
bool ffParseBrightnessCommandOptions(FFBrightnessOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_BRIGHTNESS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "ddcci-sleep"))
{
options->ddcciSleep = ffOptionParseUInt32(key, value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "compact"))
{
options->compact = ffOptionParseBoolean(value);
return true;
}
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseBrightnessJsonObject(FFBrightnessOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -215,7 +190,6 @@ void ffGenerateBrightnessJsonResult(FF_MAYBE_UNUSED FFBrightnessOptions* options
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BRIGHTNESS_MODULE_NAME,
.description = "Print current brightness level of your monitors",
.parseCommandOptions = (void*) ffParseBrightnessCommandOptions,
.parseJsonObject = (void*) ffParseBrightnessJsonObject,
.printModule = (void*) ffPrintBrightness,
.generateJsonResult = (void*) ffGenerateBrightnessJsonResult,
-14
View File
@@ -130,19 +130,6 @@ void ffPrintBtrfs(FFBtrfsOptions* options)
}
}
bool ffParseBtrfsCommandOptions(FFBtrfsOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_BTRFS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseBtrfsJsonObject(FFBtrfsOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -216,7 +203,6 @@ void ffGenerateBtrfsJsonResult(FF_MAYBE_UNUSED FFBtrfsOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_BTRFS_MODULE_NAME,
.description = "Print Linux BTRFS volumes",
.parseCommandOptions = (void*) ffParseBtrfsCommandOptions,
.parseJsonObject = (void*) ffParseBtrfsJsonObject,
.printModule = (void*) ffPrintBtrfs,
.generateJsonResult = (void*) ffGenerateBtrfsJsonResult,
-11
View File
@@ -67,16 +67,6 @@ void ffPrintCamera(FFCameraOptions* options)
}
}
bool ffParseCameraCommandOptions(FFCameraOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_CAMERA_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseCameraJsonObject(FFCameraOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -133,7 +123,6 @@ void ffGenerateCameraJsonResult(FF_MAYBE_UNUSED FFCameraOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_CAMERA_MODULE_NAME,
.description = "Print available cameras",
.parseCommandOptions = (void*) ffParseCameraCommandOptions,
.parseJsonObject = (void*) ffParseCameraJsonObject,
.printModule = (void*) ffPrintCamera,
.generateJsonResult = (void*) ffGenerateCameraJsonResult,
-11
View File
@@ -51,16 +51,6 @@ exit:
ffStrbufDestroy(&result.serial);
}
bool ffParseChassisCommandOptions(FFChassisOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_CHASSIS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseChassisJsonObject(FFChassisOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -120,7 +110,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_CHASSIS_MODULE_NAME,
.description = "Print chassis type (desktop, laptop, etc)",
.parseCommandOptions = (void*) ffParseChassisCommandOptions,
.parseJsonObject = (void*) ffParseChassisJsonObject,
.printModule = (void*) ffPrintChassis,
.generateJsonResult = (void*) ffGenerateChassisJsonResult,
-50
View File
@@ -125,55 +125,6 @@ void ffPrintColors(FFColorsOptions* options)
}
}
bool ffParseColorsCommandOptions(FFColorsOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_COLORS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "symbol"))
{
options->symbol = (FFColorsSymbol) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "block", FF_COLORS_SYMBOL_BLOCK },
{ "background", FF_COLORS_SYMBOL_BACKGROUND },
{ "circle", FF_COLORS_SYMBOL_CIRCLE },
{ "diamond", FF_COLORS_SYMBOL_DIAMOND },
{ "triangle", FF_COLORS_SYMBOL_TRIANGLE },
{ "square", FF_COLORS_SYMBOL_SQUARE },
{ "star", FF_COLORS_SYMBOL_STAR },
{},
});
return true;
}
if (ffStrEqualsIgnCase(subKey, "padding-left"))
{
options->paddingLeft = ffOptionParseUInt32(key, value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "block-width"))
{
options->block.width = (uint8_t) ffOptionParseUInt32(key, value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "block-range-start"))
{
options->block.range[0] = min((uint8_t) ffOptionParseUInt32(key, value), 15);
return true;
}
if (ffStrEqualsIgnCase(subKey, "block-range-end"))
{
options->block.range[1] = min((uint8_t) ffOptionParseUInt32(key, value), 15);
return true;
}
return false;
}
void ffParseColorsJsonObject(FFColorsOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -291,7 +242,6 @@ void ffGenerateColorsJsonConfig(FFColorsOptions* options, yyjson_mut_doc* doc, y
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_COLORS_MODULE_NAME,
.description = "Print some colored blocks",
.parseCommandOptions = (void*) ffParseColorsCommandOptions,
.parseJsonObject = (void*) ffParseColorsJsonObject,
.printModule = (void*) ffPrintColors,
.generateJsonConfig = (void*) ffGenerateColorsJsonConfig,
-29
View File
@@ -43,34 +43,6 @@ void ffPrintCommand(FFCommandOptions* options)
}
}
bool ffParseCommandCommandOptions(FFCommandOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_COMMAND_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if(ffStrEqualsIgnCase(subKey, "shell"))
{
ffOptionParseString(key, value, &options->shell);
return true;
}
if(ffStrEqualsIgnCase(subKey, "param"))
{
ffOptionParseString(key, value, &options->param);
return true;
}
if(ffStrEqualsIgnCase(subKey, "text"))
{
ffOptionParseString(key, value, &options->text);
return true;
}
return false;
}
void ffParseCommandJsonObject(FFCommandOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -151,7 +123,6 @@ void ffGenerateCommandJsonResult(FF_MAYBE_UNUSED FFCommandOptions* options, yyjs
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_COMMAND_MODULE_NAME,
.description = "Run custom shell scripts",
.parseCommandOptions = (void*) ffParseCommandCommandOptions,
.parseJsonObject = (void*) ffParseCommandJsonObject,
.printModule = (void*) ffPrintCommand,
.generateJsonResult = (void*) ffGenerateCommandJsonResult,
-20
View File
@@ -117,25 +117,6 @@ void ffPrintCPU(FFCPUOptions* options)
ffStrbufDestroy(&cpu.vendor);
}
bool ffParseCPUCommandOptions(FFCPUOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_CPU_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffTempsParseCommandOptions(key, subKey, value, &options->temp, &options->tempConfig))
return true;
if (ffStrEqualsIgnCase(subKey, "show-pe-core-count"))
{
options->showPeCoreCount = ffOptionParseBoolean(value);
return true;
}
return false;
}
void ffParseCPUJsonObject(FFCPUOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -234,7 +215,6 @@ void ffGenerateCPUJsonResult(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_CPU_MODULE_NAME,
.description = "Print CPU name, frequency, etc",
.parseCommandOptions = (void*) ffParseCPUCommandOptions,
.parseJsonObject = (void*) ffParseCPUJsonObject,
.printModule = (void*) ffPrintCPU,
.generateJsonResult = (void*) ffGenerateCPUJsonResult,
-17
View File
@@ -132,22 +132,6 @@ exit:
ffListDestroy(&result.caches[3]);
}
bool ffParseCPUCacheCommandOptions(FFCPUCacheOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_CPUCACHE_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "compact"))
{
options->compact = ffOptionParseBoolean(value);
return true;
}
return false;
}
void ffParseCPUCacheJsonObject(FFCPUCacheOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -227,7 +211,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_CPUCACHE_MODULE_NAME,
.description = "Print CPU cache sizes",
.parseCommandOptions = (void*) ffParseCPUCacheCommandOptions,
.parseJsonObject = (void*) ffParseCPUCacheJsonObject,
.printModule = (void*) ffPrintCPUCache,
.generateJsonResult = (void*) ffGenerateCPUCacheJsonResult,
-26
View File
@@ -116,31 +116,6 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
}
}
bool ffParseCPUUsageCommandOptions(FFCPUUsageOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_CPUUSAGE_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "separate"))
{
options->separate = ffOptionParseBoolean(value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "wait-time"))
{
options->waitTime = ffOptionParseUInt32(key, value);
return true;
}
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseCPUUsageJsonObject(FFCPUUsageOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -202,7 +177,6 @@ void ffGenerateCPUUsageJsonResult(FFCPUUsageOptions* options, yyjson_mut_doc* do
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_CPUUSAGE_MODULE_NAME,
.description = "Print CPU usage. Costs some time to collect data",
.parseCommandOptions = (void*) ffParseCPUUsageCommandOptions,
.parseJsonObject = (void*) ffParseCPUUsageJsonObject,
.printModule = (void*) ffPrintCPUUsage,
.generateJsonResult = (void*) ffGenerateCPUUsageJsonResult,
-11
View File
@@ -48,16 +48,6 @@ void ffPrintCursor(FFCursorOptions* options)
ffStrbufDestroy(&result.size);
}
bool ffParseCursorCommandOptions(FFCursorOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_CURSOR_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseCursorJsonObject(FFCursorOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -107,7 +97,6 @@ void ffGenerateCursorJsonResult(FF_MAYBE_UNUSED FFCursorOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_CURSOR_MODULE_NAME,
.description = "Print cursor style name",
.parseCommandOptions = (void*) ffParseCursorCommandOptions,
.parseJsonObject = (void*) ffParseCursorJsonObject,
.printModule = (void*) ffPrintCursor,
.generateJsonResult = (void*) ffGenerateCursorJsonResult,
-11
View File
@@ -9,16 +9,6 @@ void ffPrintCustom(FFCustomOptions* options)
ffPrintFormat(FF_CUSTOM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, 0, ((FFformatarg[]) {}));
}
bool ffParseCustomCommandOptions(FFCustomOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_CUSTOM_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffGenerateCustomJsonConfig(FFCustomOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
__attribute__((__cleanup__(ffDestroyCustomOptions))) FFCustomOptions defaultOptions;
@@ -43,7 +33,6 @@ void ffParseCustomJsonObject(FFCustomOptions* options, yyjson_val* module)
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_CUSTOM_MODULE_NAME,
.description = "Print a custom string, with or without key",
.parseCommandOptions = (void*) ffParseCustomCommandOptions,
.parseJsonObject = (void*) ffParseCustomJsonObject,
.printModule = (void*) ffPrintCustom,
.generateJsonConfig = (void*) ffGenerateCustomJsonConfig,
-11
View File
@@ -117,16 +117,6 @@ void ffPrintDateTime(FFDateTimeOptions* options)
puts(buffer);
}
bool ffParseDateTimeCommandOptions(FFDateTimeOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_DATETIME_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseDateTimeJsonObject(FFDateTimeOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -156,7 +146,6 @@ void ffGenerateDateTimeJsonResult(FF_MAYBE_UNUSED FFDateTimeOptions* options, yy
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_DATETIME_MODULE_NAME,
.description = "Print current date and time",
.parseCommandOptions = (void*) ffParseDateTimeCommandOptions,
.parseJsonObject = (void*) ffParseDateTimeJsonObject,
.printModule = (void*) ffPrintDateTime,
.generateJsonResult = (void*) ffGenerateDateTimeJsonResult,
-17
View File
@@ -42,22 +42,6 @@ void ffPrintDE(FFDEOptions* options)
}
}
bool ffParseDECommandOptions(FFDEOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_DE_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "slow-version-detection"))
{
options->slowVersionDetection = ffOptionParseBoolean(value);
return true;
}
return false;
}
void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -110,7 +94,6 @@ void ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_DE_MODULE_NAME,
.description = "Print desktop environment name",
.parseCommandOptions = (void*) ffParseDECommandOptions,
.parseJsonObject = (void*) ffParseDEJsonObject,
.printModule = (void*) ffPrintDE,
.generateJsonResult = (void*) ffGenerateDEJsonResult,
-95
View File
@@ -203,100 +203,6 @@ void ffPrintDisk(FFDiskOptions* options)
}
}
bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_DISK_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "folders"))
{
ffOptionParseString(key, value, &options->folders);
return true;
}
if (ffStrEqualsIgnCase(subKey, "hide-folders"))
{
ffOptionParseString(key, value, &options->hideFolders);
return true;
}
if (ffStrEqualsIgnCase(subKey, "hide-fs"))
{
ffOptionParseString(key, value, &options->hideFS);
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-regular"))
{
if (ffOptionParseBoolean(value))
options->showTypes |= FF_DISK_VOLUME_TYPE_REGULAR_BIT;
else
options->showTypes &= ~FF_DISK_VOLUME_TYPE_REGULAR_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-external"))
{
if (ffOptionParseBoolean(value))
options->showTypes |= FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
else
options->showTypes &= ~FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-hidden"))
{
if (ffOptionParseBoolean(value))
options->showTypes |= FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
else
options->showTypes &= ~FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-subvolumes"))
{
if (ffOptionParseBoolean(value))
options->showTypes |= FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
else
options->showTypes &= ~FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-readonly"))
{
if (ffOptionParseBoolean(value))
options->showTypes |= FF_DISK_VOLUME_TYPE_READONLY_BIT;
else
options->showTypes &= ~FF_DISK_VOLUME_TYPE_READONLY_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-unknown"))
{
if (ffOptionParseBoolean(value))
options->showTypes |= FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
else
options->showTypes &= ~FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "use-available"))
{
if (ffOptionParseBoolean(value))
options->calcType = FF_DISK_CALC_TYPE_AVAILABLE;
else
options->calcType = FF_DISK_CALC_TYPE_FREE;
return true;
}
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -509,7 +415,6 @@ void ffGenerateDiskJsonResult(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_DISK_MODULE_NAME,
.description = "Print partitions, space usage, file system, etc",
.parseCommandOptions = (void*) ffParseDiskCommandOptions,
.parseJsonObject = (void*) ffParseDiskJsonObject,
.printModule = (void*) ffPrintDisk,
.generateJsonResult = (void*) ffGenerateDiskJsonResult,
-29
View File
@@ -95,34 +95,6 @@ void ffPrintDiskIO(FFDiskIOOptions* options)
}
}
bool ffParseDiskIOCommandOptions(FFDiskIOOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_DISKIO_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "name-prefix"))
{
ffOptionParseString(key, value, &options->namePrefix);
return true;
}
if (ffStrEqualsIgnCase(subKey, "detect-total"))
{
options->detectTotal = ffOptionParseBoolean(value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "wait-time"))
{
options->waitTime = ffOptionParseUInt32(key, value);
return true;
}
return false;
}
void ffParseDiskIOJsonObject(FFDiskIOOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -201,7 +173,6 @@ void ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, y
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_DISKIO_MODULE_NAME,
.description = "Print physical disk I/O throughput",
.parseCommandOptions = (void*) ffParseDiskIOCommandOptions,
.parseJsonObject = (void*) ffParseDiskIOJsonObject,
.printModule = (void*) ffPrintDiskIO,
.generateJsonResult = (void*) ffGenerateDiskIOJsonResult,
+14 -55
View File
@@ -217,46 +217,6 @@ void ffPrintDisplay(FFDisplayOptions* options)
}
}
bool ffParseDisplayCommandOptions(FFDisplayOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_DISPLAY_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "compact-type"))
{
options->compactType = (FFDisplayCompactType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "none", FF_DISPLAY_COMPACT_TYPE_NONE },
{ "original", FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT },
{ "scaled", FF_DISPLAY_COMPACT_TYPE_SCALED_BIT },
{ "original-with-refresh-rate", FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT },
{ "scaled-with-refresh-rate", FF_DISPLAY_COMPACT_TYPE_SCALED_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT },
{},
});
return true;
}
if (ffStrEqualsIgnCase(subKey, "precise-refresh-rate"))
{
options->preciseRefreshRate = ffOptionParseBoolean(value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "order"))
{
options->order = (FFDisplayOrder) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "asc", FF_DISPLAY_ORDER_ASC },
{ "desc", FF_DISPLAY_ORDER_DESC },
{ "none", FF_DISPLAY_ORDER_NONE },
{},
});
return true;
}
return false;
}
void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -271,20 +231,20 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
if (yyjson_is_null(val))
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
else
{
int value;
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
{ "none", FF_DISPLAY_COMPACT_TYPE_NONE },
{ "original", FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT },
{ "scaled", FF_DISPLAY_COMPACT_TYPE_SCALED_BIT },
{ "original-with-refresh-rate", FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT },
{ "scaled-with-refresh-rate", FF_DISPLAY_COMPACT_TYPE_SCALED_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT },
{},
});
if (error)
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
else
options->compactType = (FFDisplayCompactType) value;
{
int value;
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
{ "none", FF_DISPLAY_COMPACT_TYPE_NONE },
{ "original", FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT },
{ "scaled", FF_DISPLAY_COMPACT_TYPE_SCALED_BIT },
{ "original-with-refresh-rate", FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT },
{ "scaled-with-refresh-rate", FF_DISPLAY_COMPACT_TYPE_SCALED_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT },
{},
});
if (error)
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
else
options->compactType = (FFDisplayCompactType) value;
}
continue;
}
@@ -440,7 +400,6 @@ void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_DISPLAY_MODULE_NAME,
.description = "Print resolutions, refresh rates, etc",
.parseCommandOptions = (void*) ffParseDisplayCommandOptions,
.parseJsonObject = (void*) ffParseDisplayJsonObject,
.printModule = (void*) ffPrintDisplay,
.generateJsonResult = (void*) ffGenerateDisplayJsonResult,
-22
View File
@@ -57,27 +57,6 @@ void ffPrintDNS(FFDNSOptions* options)
}
}
bool ffParseDNSCommandOptions(FFDNSOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_DNS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "show-type"))
{
options->showType = (FFDNSShowType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "both", FF_DNS_TYPE_BOTH },
{ "ipv4", FF_DNS_TYPE_IPV4_BIT },
{ "ipv6", FF_DNS_TYPE_IPV6_BIT },
{},
});
return true;
}
return false;
}
void ffParseDNSJsonObject(FFDNSOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -163,7 +142,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_DNS_MODULE_NAME,
.description = "Print configured DNS servers",
.parseCommandOptions = (void*) ffParseDNSCommandOptions,
.parseJsonObject = (void*) ffParseDNSJsonObject,
.printModule = (void*) ffPrintDNS,
.generateJsonResult = (void*) ffGenerateDNSJsonResult,
-11
View File
@@ -54,16 +54,6 @@ void ffPrintEditor(FFEditorOptions* options)
ffStrbufDestroy(&result.version);
}
bool ffParseEditorCommandOptions(FFEditorOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_EDITOR_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseEditorJsonObject(FFEditorOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -117,7 +107,6 @@ void ffGenerateEditorJsonResult(FF_MAYBE_UNUSED FFEditorOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_EDITOR_MODULE_NAME,
.description = "Print information of the default editor ($VISUAL or $EDITOR)",
.parseCommandOptions = (void*) ffParseEditorCommandOptions,
.parseJsonObject = (void*) ffParseEditorJsonObject,
.printModule = (void*) ffPrintEditor,
.generateJsonResult = (void*) ffGenerateEditorJsonResult,
-11
View File
@@ -41,16 +41,6 @@ void ffPrintFont(FFFontOptions* options)
ffStrbufDestroy(&font.fonts[i]);
}
bool ffParseFontCommandOptions(FFFontOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_FONT_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseFontJsonObject(FFFontOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -101,7 +91,6 @@ void ffGenerateFontJsonResult(FF_MAYBE_UNUSED FFFontOptions* options, yyjson_mut
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_FONT_MODULE_NAME,
.description = "Print system font names",
.parseCommandOptions = (void*) ffParseFontCommandOptions,
.parseJsonObject = (void*) ffParseFontJsonObject,
.printModule = (void*) ffPrintFont,
.generateJsonResult = (void*) ffGenerateFontJsonResult,
-14
View File
@@ -77,19 +77,6 @@ void ffPrintGamepad(FFGamepadOptions* options)
}
}
bool ffParseGamepadCommandOptions(FFGamepadOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_GAMEPAD_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseGamepadJsonObject(FFGamepadOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -146,7 +133,6 @@ void ffGenerateGamepadJsonResult(FF_MAYBE_UNUSED FFGamepadOptions* options, yyjs
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_GAMEPAD_MODULE_NAME,
.description = "List (connected) gamepads",
.parseCommandOptions = (void*) ffParseGamepadCommandOptions,
.parseJsonObject = (void*) ffParseGamepadJsonObject,
.printModule = (void*) ffPrintGamepad,
.generateJsonResult = (void*) ffGenerateGamepadJsonResult,
-48
View File
@@ -202,53 +202,6 @@ void ffPrintGPU(FFGPUOptions* options)
}
}
bool ffParseGPUCommandOptions(FFGPUOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_GPU_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "driver-specific"))
{
options->driverSpecific = ffOptionParseBoolean(value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "detection-method"))
{
options->detectionMethod = (FFGPUDetectionMethod) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "auto", FF_GPU_DETECTION_METHOD_AUTO },
{ "pci", FF_GPU_DETECTION_METHOD_PCI },
{ "vulkan", FF_GPU_DETECTION_METHOD_VULKAN },
{ "opencl", FF_GPU_DETECTION_METHOD_OPENCL },
{ "opengl", FF_GPU_DETECTION_METHOD_OPENGL },
{},
});
return true;
}
if (ffTempsParseCommandOptions(key, subKey, value, &options->temp, &options->tempConfig))
return true;
if (ffStrEqualsIgnCase(subKey, "hide-type"))
{
options->hideType = (FFGPUType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "none", FF_GPU_TYPE_NONE },
{ "unknown", FF_GPU_TYPE_UNKNOWN },
{ "integrated", FF_GPU_TYPE_INTEGRATED },
{ "discrete", FF_GPU_TYPE_DISCRETE },
{},
});
return true;
}
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -459,7 +412,6 @@ void ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_GPU_MODULE_NAME,
.description = "Print GPU names, graphic memory size, type, etc",
.parseCommandOptions = (void*) ffParseGPUCommandOptions,
.parseJsonObject = (void*) ffParseGPUJsonObject,
.printModule = (void*) ffPrintGPU,
.generateJsonResult = (void*) ffGenerateGPUJsonResult,
-11
View File
@@ -67,16 +67,6 @@ exit:
ffStrbufDestroy(&host.vendor);
}
bool ffParseHostCommandOptions(FFHostOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_HOST_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseHostJsonObject(FFHostOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -144,7 +134,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_HOST_MODULE_NAME,
.description = "Print product name of your computer",
.parseCommandOptions = (void*) ffParseHostCommandOptions,
.parseJsonObject = (void*) ffParseHostJsonObject,
.printModule = (void*) ffPrintHost,
.generateJsonResult = (void*) ffGenerateHostJsonResult,
-11
View File
@@ -43,16 +43,6 @@ void ffPrintIcons(FFIconsOptions* options)
ffStrbufDestroy(&result.icons2);
}
bool ffParseIconsCommandOptions(FFIconsOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_ICONS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseIconsJsonObject(FFIconsOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -99,7 +89,6 @@ void ffGenerateIconsJsonResult(FF_MAYBE_UNUSED FFIconsOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_ICONS_MODULE_NAME,
.description = "Print icon style name",
.parseCommandOptions = (void*) ffParseIconsCommandOptions,
.parseJsonObject = (void*) ffParseIconsJsonObject,
.printModule = (void*) ffPrintIcons,
.generateJsonResult = (void*) ffGenerateIconsJsonResult,
-11
View File
@@ -48,16 +48,6 @@ exit:
ffStrbufDestroy(&result.version);
}
bool ffParseInitSystemCommandOptions(FFInitSystemOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_INITSYSTEM_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseInitSystemJsonObject(FFInitSystemOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -111,7 +101,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_INITSYSTEM_MODULE_NAME,
.description = "Print init system (pid 1) name and version",
.parseCommandOptions = (void*) ffParseInitSystemCommandOptions,
.parseJsonObject = (void*) ffParseInitSystemJsonObject,
.printModule = (void*) ffPrintInitSystem,
.generateJsonResult = (void*) ffGenerateInitSystemJsonResult,
-11
View File
@@ -32,16 +32,6 @@ void ffPrintKernel(FFKernelOptions* options)
}
}
bool ffParseKernelCommandOptions(FFKernelOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_KERNEL_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseKernelJsonObject(FFKernelOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -79,7 +69,6 @@ void ffGenerateKernelJsonResult(FF_MAYBE_UNUSED FFKernelOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_KERNEL_MODULE_NAME,
.description = "Print system kernel version",
.parseCommandOptions = (void*) ffParseKernelCommandOptions,
.parseJsonObject = (void*) ffParseKernelJsonObject,
.printModule = (void*) ffPrintKernel,
.generateJsonResult = (void*) ffGenerateKernelJsonResult,
-11
View File
@@ -48,16 +48,6 @@ void ffPrintKeyboard(FFKeyboardOptions* options)
}
}
bool ffParseKeyboardCommandOptions(FFKeyboardOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_KEYBOARD_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseKeyboardJsonObject(FFKeyboardOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -109,7 +99,6 @@ void ffGenerateKeyboardJsonResult(FF_MAYBE_UNUSED FFKeyboardOptions* options, yy
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_KEYBOARD_MODULE_NAME,
.description = "List (connected) keyboards",
.parseCommandOptions = (void*) ffParseKeyboardCommandOptions,
.parseJsonObject = (void*) ffParseKeyboardJsonObject,
.printModule = (void*) ffPrintKeyboard,
.generateJsonResult = (void*) ffGenerateKeyboardJsonResult,
-11
View File
@@ -47,16 +47,6 @@ void ffPrintLM(FFLMOptions* options)
ffStrbufDestroy(&result.version);
}
bool ffParseLMCommandOptions(FFLMOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_LM_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseLMJsonObject(FFLMOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -112,7 +102,6 @@ exit:
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_LM_MODULE_NAME,
.description = "Print login manager (desktop manager) name and version",
.parseCommandOptions = (void*) ffParseLMCommandOptions,
.parseJsonObject = (void*) ffParseLMJsonObject,
.printModule = (void*) ffPrintLM,
.generateJsonResult = (void*) ffGenerateLMJsonResult,
-26
View File
@@ -90,31 +90,6 @@ void ffPrintLoadavg(FFLoadavgOptions* options)
}
}
bool ffParseLoadavgCommandOptions(FFLoadavgOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_LOADAVG_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "ndigits"))
{
options->ndigits = (uint8_t) ffOptionParseUInt32(key, value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "compact"))
{
options->compact = ffOptionParseBoolean(value);
return true;
}
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseLoadavgJsonObject(FFLoadavgOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -178,7 +153,6 @@ void ffGenerateLoadavgJsonResult(FF_MAYBE_UNUSED FFLoadavgOptions* options, yyjs
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_LOADAVG_MODULE_NAME,
.description = "Print system load averages",
.parseCommandOptions = (void*) ffParseLoadavgCommandOptions,
.parseJsonObject = (void*) ffParseLoadavgJsonObject,
.printModule = (void*) ffPrintLoadavg,
.generateJsonResult = (void*) ffGenerateLoadavgJsonResult,
-11
View File
@@ -28,16 +28,6 @@ void ffPrintLocale(FFLocaleOptions* options)
}
}
bool ffParseLocaleCommandOptions(FFLocaleOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_LOCALE_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseLocaleJsonObject(FFLocaleOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -76,7 +66,6 @@ void ffGenerateLocaleJsonResult(FF_MAYBE_UNUSED FFLocaleOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_LOCALE_MODULE_NAME,
.description = "Print system locale name",
.parseCommandOptions = (void*) ffParseLocaleCommandOptions,
.parseJsonObject = (void*) ffParseLocaleJsonObject,
.printModule = (void*) ffPrintLocale,
.generateJsonResult = (void*) ffGenerateLocaleJsonResult,
-116
View File
@@ -178,121 +178,6 @@ void ffPrintLocalIp(FFLocalIpOptions* options)
}
}
bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_LOCALIP_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "show-ipv4"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_IPV4_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_IPV4_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-ipv6"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_IPV6_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_IPV6_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-mac"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_MAC_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_MAC_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-loop"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_LOOP_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_LOOP_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-prefix-len"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_PREFIX_LEN_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_PREFIX_LEN_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-mtu"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_MTU_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_MTU_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-speed"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_SPEED_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_SPEED_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-flags"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_FLAGS_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_FLAGS_BIT;
return true;
}
if(ffStrEqualsIgnCase(subKey, "compact"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_COMPACT_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_COMPACT_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "default-route-only"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-all-ips"))
{
if (ffOptionParseBoolean(value))
options->showType |= FF_LOCALIP_TYPE_ALL_IPS_BIT;
else
options->showType &= ~FF_LOCALIP_TYPE_ALL_IPS_BIT;
return true;
}
if (ffStrEqualsIgnCase(subKey, "name-prefix"))
{
ffOptionParseString(key, value, &options->namePrefix);
return true;
}
return false;
}
void ffParseLocalIpJsonObject(FFLocalIpOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -503,7 +388,6 @@ void ffGenerateLocalIpJsonResult(FF_MAYBE_UNUSED FFLocalIpOptions* options, yyjs
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_LOCALIP_MODULE_NAME,
.description = "List local IP addresses (v4 or v6), MAC addresses, etc",
.parseCommandOptions = (void*) ffParseLocalIpCommandOptions,
.parseJsonObject = (void*) ffParseLocalIpJsonObject,
.printModule = (void*) ffPrintLocalIp,
.generateJsonResult = (void*) ffGenerateLocalIpJsonResult,
-11
View File
@@ -106,16 +106,6 @@ void ffPrintMedia(FFMediaOptions* options)
}
}
bool ffParseMediaCommandOptions(FFMediaOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_MEDIA_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseMediaJsonObject(FFMediaOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -164,7 +154,6 @@ void ffGenerateMediaJsonResult(FF_MAYBE_UNUSED FFMediaOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_MEDIA_MODULE_NAME,
.description = "Print playing song name",
.parseCommandOptions = (void*) ffParseMediaCommandOptions,
.parseJsonObject = (void*) ffParseMediaJsonObject,
.printModule = (void*) ffPrintMedia,
.generateJsonResult = (void*) ffGenerateMediaJsonResult,
-14
View File
@@ -71,19 +71,6 @@ void ffPrintMemory(FFMemoryOptions* options)
}
}
bool ffParseMemoryCommandOptions(FFMemoryOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_MEMORY_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseMemoryJsonObject(FFMemoryOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -129,7 +116,6 @@ void ffGenerateMemoryJsonResult(FF_MAYBE_UNUSED FFMemoryOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_MEMORY_MODULE_NAME,
.description = "Print system memory usage info",
.parseCommandOptions = (void*) ffParseMemoryCommandOptions,
.parseJsonObject = (void*) ffParseMemoryJsonObject,
.printModule = (void*) ffPrintMemory,
.generateJsonResult = (void*) ffGenerateMemoryJsonResult,
-11
View File
@@ -86,16 +86,6 @@ void ffPrintMonitor(FFMonitorOptions* options)
}
}
bool ffParseMonitorCommandOptions(FFMonitorOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_MONITOR_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseMonitorJsonObject(FFMonitorOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -125,7 +115,6 @@ void ffGenerateMonitorJsonResult(FF_MAYBE_UNUSED FFMonitorOptions* options, yyjs
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_MONITOR_MODULE_NAME,
.description = "Alias of Display module",
.parseCommandOptions = (void*) ffParseMonitorCommandOptions,
.parseJsonObject = (void*) ffParseMonitorJsonObject,
.printModule = (void*) ffPrintMonitor,
.generateJsonResult = (void*) ffGenerateMonitorJsonResult,
-11
View File
@@ -48,16 +48,6 @@ void ffPrintMouse(FFMouseOptions* options)
}
}
bool ffParseMouseCommandOptions(FFMouseOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_MOUSE_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseMouseJsonObject(FFMouseOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -109,7 +99,6 @@ void ffGenerateMouseJsonResult(FF_MAYBE_UNUSED FFMouseOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_MOUSE_MODULE_NAME,
.description = "List connected mouses",
.parseCommandOptions = (void*) ffParseMouseCommandOptions,
.parseJsonObject = (void*) ffParseMouseJsonObject,
.printModule = (void*) ffPrintMouse,
.generateJsonResult = (void*) ffGenerateMouseJsonResult,
-35
View File
@@ -103,40 +103,6 @@ void ffPrintNetIO(FFNetIOOptions* options)
}
}
bool ffParseNetIOCommandOptions(FFNetIOOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_NETIO_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "name-prefix"))
{
ffOptionParseString(key, value, &options->namePrefix);
return true;
}
if (ffStrEqualsIgnCase(subKey, "default-route-only"))
{
options->defaultRouteOnly = ffOptionParseBoolean(value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "detect-total"))
{
options->detectTotal = ffOptionParseBoolean(value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "wait-time"))
{
options->waitTime = ffOptionParseUInt32(key, value);
return true;
}
return false;
}
void ffParseNetIOJsonObject(FFNetIOOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -227,7 +193,6 @@ void ffGenerateNetIOJsonResult(FFNetIOOptions* options, yyjson_mut_doc* doc, yyj
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_NETIO_MODULE_NAME,
.description = "Print network I/O throughput",
.parseCommandOptions = (void*) ffParseNetIOCommandOptions,
.parseJsonObject = (void*) ffParseNetIOJsonObject,
.printModule = (void*) ffPrintNetIO,
.generateJsonResult = (void*) ffGenerateNetIOJsonResult,
-11
View File
@@ -30,16 +30,6 @@ void ffPrintOpenCL(FFOpenCLOptions* options)
}
}
bool ffParseOpenCLCommandOptions(FFOpenCLOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_OPENCL_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseOpenCLJsonObject(FFOpenCLOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -127,7 +117,6 @@ void ffGenerateOpenCLJsonResult(FF_MAYBE_UNUSED FFOpenCLOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_OPENCL_MODULE_NAME,
.description = "Print highest OpenCL version supported by the GPU",
.parseCommandOptions = (void*) ffParseOpenCLCommandOptions,
.parseJsonObject = (void*) ffParseOpenCLJsonObject,
.printModule = (void*) ffPrintOpenCL,
.generateJsonResult = (void*) ffGenerateOpenCLJsonResult,
-22
View File
@@ -43,27 +43,6 @@ void ffPrintOpenGL(FFOpenGLOptions* options)
ffStrbufDestroy(&result.library);
}
bool ffParseOpenGLCommandOptions(FFOpenGLOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_OPENGL_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "library"))
{
options->library = (FFOpenGLLibrary) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "auto", FF_OPENGL_LIBRARY_AUTO },
{ "egl", FF_OPENGL_LIBRARY_EGL },
{ "glx", FF_OPENGL_LIBRARY_GLX },
{}
});
return true;
}
return false;
}
void ffParseOpenGLJsonObject(FFOpenGLOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -151,7 +130,6 @@ void ffGenerateOpenGLJsonResult(FF_MAYBE_UNUSED FFOpenGLOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_OPENGL_MODULE_NAME,
.description = "Print highest OpenGL version supported by the GPU",
.parseCommandOptions = (void*) ffParseOpenGLCommandOptions,
.parseJsonObject = (void*) ffParseOpenGLJsonObject,
.printModule = (void*) ffPrintOpenGL,
.generateJsonResult = (void*) ffGenerateOpenGLJsonResult,
-11
View File
@@ -115,16 +115,6 @@ void ffPrintOS(FFOSOptions* options)
}
}
bool ffParseOSCommandOptions(FFOSOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_OS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseOSJsonObject(FFOSOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -172,7 +162,6 @@ void ffGenerateOSJsonResult(FF_MAYBE_UNUSED FFOSOptions* options, yyjson_mut_doc
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_OS_MODULE_NAME,
.description = "Print operating system name and version",
.parseCommandOptions = (void*) ffParseOSCommandOptions,
.parseJsonObject = (void*) ffParseOSJsonObject,
.printModule = (void*) ffPrintOS,
.generateJsonResult = (void*) ffGenerateOSJsonResult,
-112
View File
@@ -205,117 +205,6 @@ void ffPrintPackages(FFPackagesOptions* options)
ffStrbufDestroy(&counts.pacmanBranch);
}
bool ffParsePackagesCommandOptions(FFPackagesOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_PACKAGES_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "disabled"))
{
options->disabled = FF_PACKAGES_FLAG_NONE;
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
ffOptionParseString(key, value, &buffer);
char *start = buffer.chars, *end = strchr(start, ':');
while (true)
{
if (end)
*end = '\0';
#define FF_TEST_PACKAGE_NAME(name) else if (ffStrEqualsIgnCase(start, #name)) { options->disabled |= FF_PACKAGES_FLAG_ ## name ## _BIT; }
switch (toupper(start[0]))
{
case 'A': if (false);
FF_TEST_PACKAGE_NAME(APK)
FF_TEST_PACKAGE_NAME(AM)
break;
case 'B': if (false);
FF_TEST_PACKAGE_NAME(BREW)
break;
case 'C': if (false);
FF_TEST_PACKAGE_NAME(CHOCO)
break;
case 'D': if (false);
FF_TEST_PACKAGE_NAME(DPKG)
break;
case 'E': if (false);
FF_TEST_PACKAGE_NAME(EMERGE)
FF_TEST_PACKAGE_NAME(EOPKG)
break;
case 'F': if (false);
FF_TEST_PACKAGE_NAME(FLATPAK)
break;
case 'G': if (false);
FF_TEST_PACKAGE_NAME(GUIX)
break;
case 'H': if (false);
FF_TEST_PACKAGE_NAME(HPKG)
break;
case 'L': if (false);
FF_TEST_PACKAGE_NAME(LPKG)
FF_TEST_PACKAGE_NAME(LPKGBUILD)
FF_TEST_PACKAGE_NAME(LINGLONG)
break;
case 'M': if (false);
FF_TEST_PACKAGE_NAME(MACPORTS)
FF_TEST_PACKAGE_NAME(MPORT)
break;
case 'N': if (false);
FF_TEST_PACKAGE_NAME(NIX)
break;
case 'O': if (false);
FF_TEST_PACKAGE_NAME(OPKG)
break;
case 'P': if (false);
FF_TEST_PACKAGE_NAME(PACMAN)
FF_TEST_PACKAGE_NAME(PACSTALL)
FF_TEST_PACKAGE_NAME(PALUDIS)
FF_TEST_PACKAGE_NAME(PISI)
FF_TEST_PACKAGE_NAME(PKG)
FF_TEST_PACKAGE_NAME(PKGTOOL)
FF_TEST_PACKAGE_NAME(PKGSRC)
break;
case 'R': if (false);
FF_TEST_PACKAGE_NAME(RPM)
break;
case 'S': if (false);
FF_TEST_PACKAGE_NAME(SCOOP)
FF_TEST_PACKAGE_NAME(SNAP)
FF_TEST_PACKAGE_NAME(SOAR)
FF_TEST_PACKAGE_NAME(SORCERY)
break;
case 'W': if (false);
FF_TEST_PACKAGE_NAME(WINGET)
break;
case 'X': if (false);
FF_TEST_PACKAGE_NAME(XBPS)
break;
}
#undef FF_TEST_PACKAGE_NAME
if (end)
{
start = end + 1;
end = strchr(start, ':');
}
else
break;
}
return true;
}
if (ffStrEqualsIgnCase(subKey, "combined"))
{
options->combined = ffOptionParseBoolean(value);
return true;
}
return false;
}
void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -545,7 +434,6 @@ void ffGeneratePackagesJsonResult(FF_MAYBE_UNUSED FFPackagesOptions* options, yy
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_PACKAGES_MODULE_NAME,
.description = "List installed package managers and count of installed packages",
.parseCommandOptions = (void*) ffParsePackagesCommandOptions,
.parseJsonObject = (void*) ffParsePackagesJsonObject,
.printModule = (void*) ffPrintPackages,
.generateJsonResult = (void*) ffGeneratePackagesJsonResult,
-20
View File
@@ -133,25 +133,6 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options)
}
}
bool ffParsePhysicalDiskCommandOptions(FFPhysicalDiskOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_PHYSICALDISK_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "name-prefix"))
{
ffOptionParseString(key, value, &options->namePrefix);
return true;
}
if (ffTempsParseCommandOptions(key, subKey, value, &options->temp, &options->tempConfig))
return true;
return false;
}
void ffParsePhysicalDiskJsonObject(FFPhysicalDiskOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -248,7 +229,6 @@ void ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_PHYSICALDISK_MODULE_NAME,
.description = "Print physical disk information",
.parseCommandOptions = (void*) ffParsePhysicalDiskCommandOptions,
.parseJsonObject = (void*) ffParsePhysicalDiskJsonObject,
.printModule = (void*) ffPrintPhysicalDisk,
.generateJsonResult = (void*) ffGeneratePhysicalDiskJsonResult,
@@ -80,16 +80,6 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options)
}
}
bool ffParsePhysicalMemoryCommandOptions(FFPhysicalMemoryOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_PHYSICALMEMORY_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParsePhysicalMemoryJsonObject(FFPhysicalMemoryOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -152,7 +142,6 @@ void ffGeneratePhysicalMemoryJsonResult(FF_MAYBE_UNUSED FFPhysicalMemoryOptions*
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_PHYSICALMEMORY_MODULE_NAME,
.description = "Print system physical memory devices",
.parseCommandOptions = (void*) ffParsePhysicalMemoryCommandOptions,
.parseJsonObject = (void*) ffParsePhysicalMemoryJsonObject,
.printModule = (void*) ffPrintPhysicalMemory,
.generateJsonConfig = (void*) ffGeneratePhysicalMemoryJsonConfig,
-11
View File
@@ -81,16 +81,6 @@ void ffPrintPlayer(FFPlayerOptions* options)
}
}
bool ffParsePlayerCommandOptions(FFPlayerOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_PLAYER_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParsePlayerJsonObject(FFPlayerOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -120,7 +110,6 @@ void ffGeneratePlayerJsonResult(FF_MAYBE_UNUSED FFMediaOptions* options, yyjson_
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_PLAYER_MODULE_NAME,
.description = "Print music player name",
.parseCommandOptions = (void*) ffParsePlayerCommandOptions,
.parseJsonObject = (void*) ffParsePlayerJsonObject,
.printModule = (void*) ffPrintPlayer,
.generateJsonResult = (void*) ffGeneratePlayerJsonResult,
-11
View File
@@ -56,16 +56,6 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
}
}
bool ffParsePowerAdapterCommandOptions(FFPowerAdapterOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_POWERADAPTER_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffGeneratePowerAdapterJsonConfig(FFPowerAdapterOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
__attribute__((__cleanup__(ffDestroyPowerAdapterOptions))) FFPowerAdapterOptions defaultOptions;
@@ -124,7 +114,6 @@ void ffGeneratePowerAdapterJsonResult(FF_MAYBE_UNUSED FFPowerAdapterOptions* opt
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_POWERADAPTER_MODULE_NAME,
.description = "Print power adapter name and charging watts",
.parseCommandOptions = (void*) ffParsePowerAdapterCommandOptions,
.parseJsonObject = (void*) ffParsePowerAdapterJsonObject,
.printModule = (void*) ffPrintPowerAdapter,
.generateJsonResult = (void*) ffGeneratePowerAdapterJsonResult,
-11
View File
@@ -29,16 +29,6 @@ void ffPrintProcesses(FFProcessesOptions* options)
}
}
bool ffParseProcessesCommandOptions(FFProcessesOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_PROCESSES_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseProcessesJsonObject(FFProcessesOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -77,7 +67,6 @@ void ffGenerateProcessesJsonResult(FF_MAYBE_UNUSED FFProcessesOptions* options,
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_PROCESSES_MODULE_NAME,
.description = "Print number of running processes",
.parseCommandOptions = (void*) ffParseProcessesCommandOptions,
.parseJsonObject = (void*) ffParseProcessesJsonObject,
.printModule = (void*) ffPrintProcesses,
.generateJsonResult = (void*) ffGenerateProcessesJsonResult,
-29
View File
@@ -39,34 +39,6 @@ void ffPrintPublicIp(FFPublicIpOptions* options)
ffStrbufDestroy(&result.location);
}
bool ffParsePublicIpCommandOptions(FFPublicIpOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_PUBLICIP_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "url"))
{
ffOptionParseString(key, value, &options->url);
return true;
}
if (ffStrEqualsIgnCase(subKey, "timeout"))
{
options->timeout = ffOptionParseUInt32(key, value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "ipv6"))
{
options->ipv6 = ffOptionParseBoolean(value);
return true;
}
return false;
}
void ffParsePublicIpJsonObject(FFPublicIpOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -139,7 +111,6 @@ void ffGeneratePublicIpJsonResult(FFPublicIpOptions* options, yyjson_mut_doc* do
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_PUBLICIP_MODULE_NAME,
.description = "Print your public IP address, etc",
.parseCommandOptions = (void*) ffParsePublicIpCommandOptions,
.parseJsonObject = (void*) ffParsePublicIpJsonObject,
.printModule = (void*) ffPrintPublicIp,
.generateJsonResult = (void*) ffGeneratePublicIpJsonResult,
-27
View File
@@ -114,32 +114,6 @@ void ffPrintSeparator(FFSeparatorOptions* options)
putchar('\n');
}
bool ffParseSeparatorCommandOptions(FFSeparatorOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_SEPARATOR_MODULE_NAME);
if (!subKey) return false;
if (ffStrEqualsIgnCase(subKey, "string"))
{
ffOptionParseString(key, value, &options->string);
return true;
}
if (ffStrEqualsIgnCase(subKey, "output-color"))
{
ffOptionParseColor(value, &options->outputColor);
return true;
}
if (ffStrEqualsIgnCase(subKey, "length"))
{
options->length = ffOptionParseUInt32(key, value);
return true;
}
return false;
}
void ffParseSeparatorJsonObject(FFSeparatorOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -183,7 +157,6 @@ void ffGenerateSeparatorJsonConfig(FFSeparatorOptions* options, yyjson_mut_doc*
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_SEPARATOR_MODULE_NAME,
.description = "Print a separator line",
.parseCommandOptions = (void*) ffParseSeparatorCommandOptions,
.parseJsonObject = (void*) ffParseSeparatorJsonObject,
.printModule = (void*) ffPrintSeparator,
.generateJsonConfig = (void*) ffGenerateSeparatorJsonConfig,
-11
View File
@@ -42,16 +42,6 @@ void ffPrintShell(FFShellOptions* options)
}
}
bool ffParseShellCommandOptions(FFShellOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_SHELL_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseShellJsonObject(FFShellOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -101,7 +91,6 @@ void ffGenerateShellJsonResult(FF_MAYBE_UNUSED FFShellOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_SHELL_MODULE_NAME,
.description = "Print current shell name and version",
.parseCommandOptions = (void*) ffParseShellCommandOptions,
.parseJsonObject = (void*) ffParseShellJsonObject,
.printModule = (void*) ffPrintShell,
.generateJsonResult = (void*) ffGenerateShellJsonResult,
-25
View File
@@ -112,30 +112,6 @@ void ffPrintSound(FFSoundOptions* options)
}
}
bool ffParseSoundCommandOptions(FFSoundOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_SOUND_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "sound-type"))
{
options->soundType = (FFSoundType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
{ "main", FF_SOUND_TYPE_MAIN },
{ "active", FF_SOUND_TYPE_ACTIVE },
{ "all", FF_SOUND_TYPE_ALL },
{},
});
return true;
}
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseSoundJsonObject(FFSoundOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -233,7 +209,6 @@ void ffGenerateSoundJsonResult(FF_MAYBE_UNUSED FFSoundOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_SOUND_MODULE_NAME,
.description = "Print sound devices, volume, etc",
.parseCommandOptions = (void*) ffParseSoundCommandOptions,
.parseJsonObject = (void*) ffParseSoundJsonObject,
.printModule = (void*) ffPrintSound,
.generateJsonResult = (void*) ffGenerateSoundJsonResult,
-20
View File
@@ -131,25 +131,6 @@ void ffPrintSwap(FFSwapOptions* options)
}
}
bool ffParseSwapCommandOptions(FFSwapOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_SWAP_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
if (ffStrEqualsIgnCase(subKey, "separate"))
{
options->separate = ffOptionParseBoolean(value);
return true;
}
return false;
}
void ffParseSwapJsonObject(FFSwapOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -211,7 +192,6 @@ void ffGenerateSwapJsonResult(FF_MAYBE_UNUSED FFSwapOptions* options, yyjson_mut
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_SWAP_MODULE_NAME,
.description = "Print swap (paging file) space usage",
.parseCommandOptions = (void*) ffParseSwapCommandOptions,
.parseJsonObject = (void*) ffParseSwapJsonObject,
.printModule = (void*) ffPrintSwap,
.generateJsonResult = (void*) ffGenerateSwapJsonResult,
-11
View File
@@ -38,16 +38,6 @@ void ffPrintTerminal(FFTerminalOptions* options)
}
}
bool ffParseTerminalCommandOptions(FFTerminalOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_TERMINAL_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseTerminalJsonObject(FFTerminalOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -94,7 +84,6 @@ void ffGenerateTerminalJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options, yy
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_TERMINAL_MODULE_NAME,
.description = "Print current terminal name and version",
.parseCommandOptions = (void*) ffParseTerminalCommandOptions,
.parseJsonObject = (void*) ffParseTerminalJsonObject,
.printModule = (void*) ffPrintTerminal,
.generateJsonResult = (void*) ffGenerateTerminalJsonResult,
-11
View File
@@ -46,16 +46,6 @@ void ffPrintTerminalFont(FFTerminalFontOptions* options)
ffFontDestroy(&terminalFont.fallback);
}
bool ffParseTerminalFontCommandOptions(FFTerminalFontOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_TERMINALFONT_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseTerminalFontJsonObject(FFTerminalFontOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -119,7 +109,6 @@ void ffGenerateTerminalFontJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_TERMINALFONT_MODULE_NAME,
.description = "Print font name and size used by current terminal",
.parseCommandOptions = (void*) ffParseTerminalFontCommandOptions,
.parseJsonObject = (void*) ffParseTerminalFontJsonObject,
.printModule = (void*) ffPrintTerminalFont,
.generateJsonResult = (void*) ffGenerateTerminalFontJsonResult,
-11
View File
@@ -38,16 +38,6 @@ void ffPrintTerminalSize(FFTerminalSizeOptions* options)
}
}
bool ffParseTerminalSizeCommandOptions(FFTerminalSizeOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_TERMINALSIZE_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseTerminalSizeJsonObject(FFTerminalSizeOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -89,7 +79,6 @@ void ffGenerateTerminalSizeJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_TERMINALSIZE_MODULE_NAME,
.description = "Print current terminal size",
.parseCommandOptions = (void*) ffParseTerminalSizeCommandOptions,
.parseJsonObject = (void*) ffParseTerminalSizeJsonObject,
.printModule = (void*) ffPrintTerminalSize,
.generateJsonResult = (void*) ffGenerateTerminalSizeJsonResult,
-11
View File
@@ -43,16 +43,6 @@ void ffPrintTerminalTheme(FFTerminalThemeOptions* options)
}
}
bool ffParseTerminalThemeCommandOptions(FFTerminalThemeOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_TERMINALTHEME_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseTerminalThemeJsonObject(FFTerminalThemeOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -102,7 +92,6 @@ void ffGenerateTerminalThemeJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* option
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_TERMINALTHEME_MODULE_NAME,
.description = "Print current terminal theme (foreground and background colors)",
.parseCommandOptions = (void*) ffParseTerminalThemeCommandOptions,
.parseJsonObject = (void*) ffParseTerminalThemeJsonObject,
.printModule = (void*) ffPrintTerminalTheme,
.generateJsonResult = (void*) ffGenerateTerminalThemeJsonResult,
-11
View File
@@ -43,16 +43,6 @@ void ffPrintTheme(FFThemeOptions* options)
ffStrbufDestroy(&result.theme2);
}
bool ffParseThemeCommandOptions(FFThemeOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_THEME_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseThemeJsonObject(FFThemeOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -99,7 +89,6 @@ void ffGenerateThemeJsonResult(FF_MAYBE_UNUSED FFThemeOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_THEME_MODULE_NAME,
.description = "Print current theme of desktop environment",
.parseCommandOptions = (void*) ffParseThemeCommandOptions,
.parseJsonObject = (void*) ffParseThemeJsonObject,
.printModule = (void*) ffPrintTheme,
.generateJsonResult = (void*) ffGenerateThemeJsonResult,
-35
View File
@@ -68,40 +68,6 @@ void ffPrintTitle(FFTitleOptions* options)
}
}
bool ffParseTitleCommandOptions(FFTitleOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_TITLE_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "fqdn"))
{
options->fqdn = ffOptionParseBoolean(value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "color-user"))
{
ffOptionParseColor(value, &options->colorUser);
return true;
}
if (ffStrEqualsIgnCase(subKey, "color-at"))
{
ffOptionParseColor(value, &options->colorAt);
return true;
}
if (ffStrEqualsIgnCase(subKey, "color-host"))
{
ffOptionParseColor(value, &options->colorHost);
return true;
}
return false;
}
void ffParseTitleJsonObject(FFTitleOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -177,7 +143,6 @@ void ffGenerateTitleJsonResult(FF_MAYBE_UNUSED FFTitleOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_TITLE_MODULE_NAME,
.description = "Print title, which contains your user name, hostname",
.parseCommandOptions = (void*) ffParseTitleCommandOptions,
.parseJsonObject = (void*) ffParseTitleJsonObject,
.printModule = (void*) ffPrintTitle,
.generateJsonResult = (void*) ffGenerateTitleJsonResult,
-11
View File
@@ -38,16 +38,6 @@ void ffPrintTPM(FFTPMOptions* options)
ffStrbufDestroy(&result.description);
}
bool ffParseTPMCommandOptions(FFTPMOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_TPM_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseTPMJsonObject(FFTPMOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -94,7 +84,6 @@ void ffGenerateTPMJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options, yyjson_
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_TPM_MODULE_NAME,
.description = "Print info of Trusted Platform Module (TPM) Security Device",
.parseCommandOptions = (void*) ffParseTPMCommandOptions,
.parseJsonObject = (void*) ffParseTPMJsonObject,
.printModule = (void*) ffPrintTPM,
.generateJsonResult = (void*) ffGenerateTPMJsonResult,
-11
View File
@@ -56,16 +56,6 @@ void ffPrintUptime(FFUptimeOptions* options)
}
}
bool ffParseUptimeCommandOptions(FFUptimeOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_UPTIME_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseUptimeJsonObject(FFUptimeOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -106,7 +96,6 @@ void ffGenerateUptimeJsonResult(FF_MAYBE_UNUSED FFUptimeOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_UPTIME_MODULE_NAME,
.description = "Print how long system has been running",
.parseCommandOptions = (void*) ffParseUptimeCommandOptions,
.parseJsonObject = (void*) ffParseUptimeJsonObject,
.printModule = (void*) ffPrintUptime,
.generateJsonResult = (void*) ffGenerateUptimeJsonResult,
-23
View File
@@ -107,28 +107,6 @@ void ffPrintUsers(FFUsersOptions* options)
}
}
bool ffParseUsersCommandOptions(FFUsersOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_USERS_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "compact"))
{
options->compact = ffOptionParseBoolean(value);
return true;
}
if (ffStrEqualsIgnCase(subKey, "myself-only"))
{
options->myselfOnly = ffOptionParseBoolean(value);
return true;
}
return false;
}
void ffParseUsersJsonObject(FFUsersOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -210,7 +188,6 @@ void ffGenerateUsersJsonResult(FFUsersOptions* options, yyjson_mut_doc* doc, yyj
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_USERS_MODULE_NAME,
.description = "Print users currently logged in",
.parseCommandOptions = (void*) ffParseUsersCommandOptions,
.parseJsonObject = (void*) ffParseUsersJsonObject,
.printModule = (void*) ffPrintUsers,
.generateJsonResult = (void*) ffGenerateUsersJsonResult,
-11
View File
@@ -44,16 +44,6 @@ void ffPrintVersion(FFVersionOptions* options)
}
}
bool ffParseVersionCommandOptions(FFVersionOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_VERSION_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseVersionJsonObject(FFVersionOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -110,7 +100,6 @@ void ffGenerateVersionJsonResult(FF_MAYBE_UNUSED FFVersionOptions* options, yyjs
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_VERSION_MODULE_NAME,
.description = "Print Fastfetch version",
.parseCommandOptions = (void*) ffParseVersionCommandOptions,
.parseJsonObject = (void*) ffParseVersionJsonObject,
.printModule = (void*) ffPrintVersion,
.generateJsonResult = (void*) ffGenerateVersionJsonResult,
-11
View File
@@ -50,16 +50,6 @@ void ffPrintVulkan(FFVulkanOptions* options)
}
}
bool ffParseVulkanCommandOptions(FFVulkanOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_VULKAN_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseVulkanJsonObject(FFVulkanOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -141,7 +131,6 @@ void ffGenerateVulkanJsonResult(FF_MAYBE_UNUSED FFVulkanOptions* options, yyjson
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_VULKAN_MODULE_NAME,
.description = "Print highest Vulkan version supported by the GPU",
.parseCommandOptions = (void*) ffParseVulkanCommandOptions,
.parseJsonObject = (void*) ffParseVulkanJsonObject,
.printModule = (void*) ffPrintVulkan,
.generateJsonResult = (void*) ffGenerateVulkanJsonResult,
-11
View File
@@ -40,16 +40,6 @@ void ffPrintWallpaper(FFWallpaperOptions* options)
}
}
bool ffParseWallpaperCommandOptions(FFWallpaperOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_WALLPAPER_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseWallpaperJsonObject(FFWallpaperOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -86,7 +76,6 @@ void ffGenerateWallpaperJsonResult(FF_MAYBE_UNUSED FFWallpaperOptions* options,
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_WALLPAPER_MODULE_NAME,
.description = "Print image file path of current wallpaper",
.parseCommandOptions = (void*) ffParseWallpaperCommandOptions,
.parseJsonObject = (void*) ffParseWallpaperJsonObject,
.printModule = (void*) ffPrintWallpaper,
.generateJsonResult = (void*) ffGenerateWallpaperJsonResult,
-29
View File
@@ -29,34 +29,6 @@ void ffPrintWeather(FFWeatherOptions* options)
}
}
bool ffParseWeatherCommandOptions(FFWeatherOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_WEATHER_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "location"))
{
ffOptionParseString(key, value, &options->location);
return true;
}
if (ffStrEqualsIgnCase(subKey, "output-format"))
{
ffOptionParseString(key, value, &options->outputFormat);
return true;
}
if (ffStrEqualsIgnCase(subKey, "timeout"))
{
options->timeout = ffOptionParseUInt32(key, value);
return true;
}
return false;
}
void ffParseWeatherJsonObject(FFWeatherOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -122,7 +94,6 @@ void ffGenerateWeatherJsonResult(FFWeatherOptions* options, yyjson_mut_doc* doc,
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_WEATHER_MODULE_NAME,
.description = "Print weather information",
.parseCommandOptions = (void*) ffParseWeatherCommandOptions,
.parseJsonObject = (void*) ffParseWeatherJsonObject,
.printModule = (void*) ffPrintWeather,
.generateJsonResult = (void*) ffGenerateWeatherJsonResult,
-14
View File
@@ -136,19 +136,6 @@ void ffPrintWifi(FFWifiOptions* options)
}
}
bool ffParseWifiCommandOptions(FFWifiOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_WIFI_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseWifiJsonObject(FFWifiOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -222,7 +209,6 @@ void ffGenerateWifiJsonResult(FF_MAYBE_UNUSED FFWifiOptions* options, yyjson_mut
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_WIFI_MODULE_NAME,
.description = "Print connected Wi-Fi info (SSID, connection and security protocol)",
.parseCommandOptions = (void*) ffParseWifiCommandOptions,
.parseJsonObject = (void*) ffParseWifiJsonObject,
.printModule = (void*) ffPrintWifi,
.generateJsonResult = (void*) ffGenerateWifiJsonResult,
-17
View File
@@ -63,22 +63,6 @@ void ffPrintWM(FFWMOptions* options)
}
}
bool ffParseWMCommandOptions(FFWMOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_WM_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffStrEqualsIgnCase(subKey, "detect-plugin"))
{
options->detectPlugin = ffOptionParseBoolean(value);
return true;
}
return false;
}
void ffParseWMJsonObject(FFWMOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -138,7 +122,6 @@ void ffGenerateWMJsonResult(FF_MAYBE_UNUSED FFWMOptions* options, yyjson_mut_doc
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_WM_MODULE_NAME,
.description = "Print window manager name and version",
.parseCommandOptions = (void*) ffParseWMCommandOptions,
.parseJsonObject = (void*) ffParseWMJsonObject,
.printModule = (void*) ffPrintWM,
.generateJsonResult = (void*) ffGenerateWMJsonResult,
-11
View File
@@ -29,16 +29,6 @@ void ffPrintWMTheme(FFWMThemeOptions* options)
}
}
bool ffParseWMThemeCommandOptions(FFWMThemeOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_WMTHEME_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
return false;
}
void ffParseWMThemeJsonObject(FFWMThemeOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -75,7 +65,6 @@ void ffGenerateWMThemeJsonResult(FF_MAYBE_UNUSED FFWMThemeOptions* options, yyjs
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_WMTHEME_MODULE_NAME,
.description = "Print current theme of window manager",
.parseCommandOptions = (void*) ffParseWMThemeCommandOptions,
.parseJsonObject = (void*) ffParseWMThemeJsonObject,
.printModule = (void*) ffPrintWMTheme,
.generateJsonResult = (void*) ffGenerateWMThemeJsonResult,
-14
View File
@@ -107,19 +107,6 @@ void ffPrintZpool(FFZpoolOptions* options)
}
}
bool ffParseZpoolCommandOptions(FFZpoolOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_ZPOOL_MODULE_NAME);
if (!subKey) return false;
if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs))
return true;
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
return false;
}
void ffParseZpoolJsonObject(FFZpoolOptions* options, yyjson_val* module)
{
yyjson_val *key, *val;
@@ -180,7 +167,6 @@ void ffGenerateZpoolJsonResult(FF_MAYBE_UNUSED FFZpoolOptions* options, yyjson_m
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_ZPOOL_MODULE_NAME,
.description = "Print ZFS storage pools",
.parseCommandOptions = (void*) ffParseZpoolCommandOptions,
.parseJsonObject = (void*) ffParseZpoolJsonObject,
.printModule = (void*) ffPrintZpool,
.generateJsonResult = (void*) ffGenerateZpoolJsonResult,