From 094d736d38ca699b9ad192d7d3e602ccada44031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 3 Aug 2025 09:26:17 +0800 Subject: [PATCH] Modules: remove all `parseCommandOptions` and related stuff --- src/common/commandoption.c | 12 -- src/common/commandoption.h | 1 - src/common/option.h | 1 - src/fastfetch.c | 3 +- src/modules/battery/battery.c | 25 ----- src/modules/bios/bios.c | 11 -- src/modules/bluetooth/bluetooth.c | 20 ---- src/modules/bluetoothradio/bluetoothradio.c | 11 -- src/modules/board/board.c | 11 -- src/modules/bootmgr/bootmgr.c | 11 -- src/modules/break/break.c | 6 - src/modules/brightness/brightness.c | 26 ----- src/modules/btrfs/btrfs.c | 14 --- src/modules/camera/camera.c | 11 -- src/modules/chassis/chassis.c | 11 -- src/modules/colors/colors.c | 50 --------- src/modules/command/command.c | 29 ----- src/modules/cpu/cpu.c | 20 ---- src/modules/cpucache/cpucache.c | 17 --- src/modules/cpuusage/cpuusage.c | 26 ----- src/modules/cursor/cursor.c | 11 -- src/modules/custom/custom.c | 11 -- src/modules/datetime/datetime.c | 11 -- src/modules/de/de.c | 17 --- src/modules/disk/disk.c | 95 ---------------- src/modules/diskio/diskio.c | 29 ----- src/modules/display/display.c | 69 +++--------- src/modules/dns/dns.c | 22 ---- src/modules/editor/editor.c | 11 -- src/modules/font/font.c | 11 -- src/modules/gamepad/gamepad.c | 14 --- src/modules/gpu/gpu.c | 48 -------- src/modules/host/host.c | 11 -- src/modules/icons/icons.c | 11 -- src/modules/initsystem/initsystem.c | 11 -- src/modules/kernel/kernel.c | 11 -- src/modules/keyboard/keyboard.c | 11 -- src/modules/lm/lm.c | 11 -- src/modules/loadavg/loadavg.c | 26 ----- src/modules/locale/locale.c | 11 -- src/modules/localip/localip.c | 116 -------------------- src/modules/media/media.c | 11 -- src/modules/memory/memory.c | 14 --- src/modules/monitor/monitor.c | 11 -- src/modules/mouse/mouse.c | 11 -- src/modules/netio/netio.c | 35 ------ src/modules/opencl/opencl.c | 11 -- src/modules/opengl/opengl.c | 22 ---- src/modules/os/os.c | 11 -- src/modules/packages/packages.c | 112 ------------------- src/modules/physicaldisk/physicaldisk.c | 20 ---- src/modules/physicalmemory/physicalmemory.c | 11 -- src/modules/player/player.c | 11 -- src/modules/poweradapter/poweradapter.c | 11 -- src/modules/processes/processes.c | 11 -- src/modules/publicip/publicip.c | 29 ----- src/modules/separator/separator.c | 27 ----- src/modules/shell/shell.c | 11 -- src/modules/sound/sound.c | 25 ----- src/modules/swap/swap.c | 20 ---- src/modules/terminal/terminal.c | 11 -- src/modules/terminalfont/terminalfont.c | 11 -- src/modules/terminalsize/terminalsize.c | 11 -- src/modules/terminaltheme/terminaltheme.c | 11 -- src/modules/theme/theme.c | 11 -- src/modules/title/title.c | 35 ------ src/modules/tpm/tpm.c | 11 -- src/modules/uptime/uptime.c | 11 -- src/modules/users/users.c | 23 ---- src/modules/version/version.c | 11 -- src/modules/vulkan/vulkan.c | 11 -- src/modules/wallpaper/wallpaper.c | 11 -- src/modules/weather/weather.c | 29 ----- src/modules/wifi/wifi.c | 14 --- src/modules/wm/wm.c | 17 --- src/modules/wmtheme/wmtheme.c | 11 -- src/modules/zpool/zpool.c | 14 --- 77 files changed, 15 insertions(+), 1536 deletions(-) diff --git a/src/common/commandoption.c b/src/common/commandoption.c index d91072928..004f81044 100644 --- a/src/common/commandoption.c +++ b/src/common/commandoption.c @@ -10,18 +10,6 @@ #include #include -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; diff --git a/src/common/commandoption.h b/src/common/commandoption.h index f8cf12044..98472a13a 100644 --- a/src/common/commandoption.h +++ b/src/common/commandoption.h @@ -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); diff --git a/src/common/option.h b/src/common/option.h index 689881a0a..0e68ec4e1 100644 --- a/src/common/option.h +++ b/src/common/option.h @@ -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); diff --git a/src/fastfetch.c b/src/fastfetch.c index 9a278619c..43cfd911d 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -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 diff --git a/src/modules/battery/battery.c b/src/modules/battery/battery.c index ae8be7486..90f211760 100644 --- a/src/modules/battery/battery.c +++ b/src/modules/battery/battery.c @@ -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, diff --git a/src/modules/bios/bios.c b/src/modules/bios/bios.c index f07a441f8..c9e758e59 100644 --- a/src/modules/bios/bios.c +++ b/src/modules/bios/bios.c @@ -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, diff --git a/src/modules/bluetooth/bluetooth.c b/src/modules/bluetooth/bluetooth.c index 3433c3ef6..6274e8c4a 100644 --- a/src/modules/bluetooth/bluetooth.c +++ b/src/modules/bluetooth/bluetooth.c @@ -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, diff --git a/src/modules/bluetoothradio/bluetoothradio.c b/src/modules/bluetoothradio/bluetoothradio.c index 93e52f686..2432ab633 100644 --- a/src/modules/bluetoothradio/bluetoothradio.c +++ b/src/modules/bluetoothradio/bluetoothradio.c @@ -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, diff --git a/src/modules/board/board.c b/src/modules/board/board.c index 0f226e2d8..3c5c29873 100644 --- a/src/modules/board/board.c +++ b/src/modules/board/board.c @@ -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, diff --git a/src/modules/bootmgr/bootmgr.c b/src/modules/bootmgr/bootmgr.c index 01a2279d6..e5084e318 100644 --- a/src/modules/bootmgr/bootmgr.c +++ b/src/modules/bootmgr/bootmgr.c @@ -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, diff --git a/src/modules/break/break.c b/src/modules/break/break.c index 39a47c0d4..fbb88b637 100644 --- a/src/modules/break/break.c +++ b/src/modules/break/break.c @@ -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, }; diff --git a/src/modules/brightness/brightness.c b/src/modules/brightness/brightness.c index cd73a4dee..8b5a43d6a 100644 --- a/src/modules/brightness/brightness.c +++ b/src/modules/brightness/brightness.c @@ -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, diff --git a/src/modules/btrfs/btrfs.c b/src/modules/btrfs/btrfs.c index 2eb78e12a..22db04bca 100644 --- a/src/modules/btrfs/btrfs.c +++ b/src/modules/btrfs/btrfs.c @@ -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, diff --git a/src/modules/camera/camera.c b/src/modules/camera/camera.c index 515df46c8..78215dd5c 100644 --- a/src/modules/camera/camera.c +++ b/src/modules/camera/camera.c @@ -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, diff --git a/src/modules/chassis/chassis.c b/src/modules/chassis/chassis.c index e9c4056ad..867c0201b 100644 --- a/src/modules/chassis/chassis.c +++ b/src/modules/chassis/chassis.c @@ -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, diff --git a/src/modules/colors/colors.c b/src/modules/colors/colors.c index bad4666da..59946166d 100644 --- a/src/modules/colors/colors.c +++ b/src/modules/colors/colors.c @@ -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, diff --git a/src/modules/command/command.c b/src/modules/command/command.c index 99ade943c..0e05d6f77 100644 --- a/src/modules/command/command.c +++ b/src/modules/command/command.c @@ -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, diff --git a/src/modules/cpu/cpu.c b/src/modules/cpu/cpu.c index 3d44657c3..49c5a59a8 100644 --- a/src/modules/cpu/cpu.c +++ b/src/modules/cpu/cpu.c @@ -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, diff --git a/src/modules/cpucache/cpucache.c b/src/modules/cpucache/cpucache.c index 71bf5b465..7a509fda6 100644 --- a/src/modules/cpucache/cpucache.c +++ b/src/modules/cpucache/cpucache.c @@ -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, diff --git a/src/modules/cpuusage/cpuusage.c b/src/modules/cpuusage/cpuusage.c index ab78e456f..4f3b244d5 100644 --- a/src/modules/cpuusage/cpuusage.c +++ b/src/modules/cpuusage/cpuusage.c @@ -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, diff --git a/src/modules/cursor/cursor.c b/src/modules/cursor/cursor.c index 80f101f11..573eca95f 100644 --- a/src/modules/cursor/cursor.c +++ b/src/modules/cursor/cursor.c @@ -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, diff --git a/src/modules/custom/custom.c b/src/modules/custom/custom.c index 70c67e76d..5831430c5 100644 --- a/src/modules/custom/custom.c +++ b/src/modules/custom/custom.c @@ -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, diff --git a/src/modules/datetime/datetime.c b/src/modules/datetime/datetime.c index 9d7ca2651..dd82937f0 100644 --- a/src/modules/datetime/datetime.c +++ b/src/modules/datetime/datetime.c @@ -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, diff --git a/src/modules/de/de.c b/src/modules/de/de.c index d0e290090..7f0020b11 100644 --- a/src/modules/de/de.c +++ b/src/modules/de/de.c @@ -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, diff --git a/src/modules/disk/disk.c b/src/modules/disk/disk.c index 9f71ec786..a6ac53a72 100644 --- a/src/modules/disk/disk.c +++ b/src/modules/disk/disk.c @@ -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, diff --git a/src/modules/diskio/diskio.c b/src/modules/diskio/diskio.c index f5f805d0e..6c73f3e21 100644 --- a/src/modules/diskio/diskio.c +++ b/src/modules/diskio/diskio.c @@ -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, diff --git a/src/modules/display/display.c b/src/modules/display/display.c index e6ffca361..d60876572 100644 --- a/src/modules/display/display.c +++ b/src/modules/display/display.c @@ -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, diff --git a/src/modules/dns/dns.c b/src/modules/dns/dns.c index 246006eab..815865ff6 100644 --- a/src/modules/dns/dns.c +++ b/src/modules/dns/dns.c @@ -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, diff --git a/src/modules/editor/editor.c b/src/modules/editor/editor.c index 4baa02352..67223bb50 100644 --- a/src/modules/editor/editor.c +++ b/src/modules/editor/editor.c @@ -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, diff --git a/src/modules/font/font.c b/src/modules/font/font.c index 3829901e2..bf0fc2459 100644 --- a/src/modules/font/font.c +++ b/src/modules/font/font.c @@ -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, diff --git a/src/modules/gamepad/gamepad.c b/src/modules/gamepad/gamepad.c index f3f9b37ae..5e6e394d3 100644 --- a/src/modules/gamepad/gamepad.c +++ b/src/modules/gamepad/gamepad.c @@ -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, diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index 06098e9e5..b608dc300 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -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, diff --git a/src/modules/host/host.c b/src/modules/host/host.c index 7d9a68f62..3d4fd3942 100644 --- a/src/modules/host/host.c +++ b/src/modules/host/host.c @@ -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, diff --git a/src/modules/icons/icons.c b/src/modules/icons/icons.c index a708e6c2c..ae2ad783b 100644 --- a/src/modules/icons/icons.c +++ b/src/modules/icons/icons.c @@ -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, diff --git a/src/modules/initsystem/initsystem.c b/src/modules/initsystem/initsystem.c index 99669aaab..591a78e0a 100644 --- a/src/modules/initsystem/initsystem.c +++ b/src/modules/initsystem/initsystem.c @@ -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, diff --git a/src/modules/kernel/kernel.c b/src/modules/kernel/kernel.c index 421ebab03..fd21f67ed 100644 --- a/src/modules/kernel/kernel.c +++ b/src/modules/kernel/kernel.c @@ -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, diff --git a/src/modules/keyboard/keyboard.c b/src/modules/keyboard/keyboard.c index 35b4f5d86..4b2a34329 100644 --- a/src/modules/keyboard/keyboard.c +++ b/src/modules/keyboard/keyboard.c @@ -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, diff --git a/src/modules/lm/lm.c b/src/modules/lm/lm.c index 4cdb42a70..9afcdefc4 100644 --- a/src/modules/lm/lm.c +++ b/src/modules/lm/lm.c @@ -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, diff --git a/src/modules/loadavg/loadavg.c b/src/modules/loadavg/loadavg.c index afd443cfd..1fb7655e8 100644 --- a/src/modules/loadavg/loadavg.c +++ b/src/modules/loadavg/loadavg.c @@ -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, diff --git a/src/modules/locale/locale.c b/src/modules/locale/locale.c index 04e7d9159..290f9196e 100644 --- a/src/modules/locale/locale.c +++ b/src/modules/locale/locale.c @@ -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, diff --git a/src/modules/localip/localip.c b/src/modules/localip/localip.c index 16680c690..cfc936fdf 100644 --- a/src/modules/localip/localip.c +++ b/src/modules/localip/localip.c @@ -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, diff --git a/src/modules/media/media.c b/src/modules/media/media.c index d52a9f3c8..71dfb96ea 100644 --- a/src/modules/media/media.c +++ b/src/modules/media/media.c @@ -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, diff --git a/src/modules/memory/memory.c b/src/modules/memory/memory.c index 711fbae0d..1948a162e 100644 --- a/src/modules/memory/memory.c +++ b/src/modules/memory/memory.c @@ -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, diff --git a/src/modules/monitor/monitor.c b/src/modules/monitor/monitor.c index 526bde08c..fd0efac20 100644 --- a/src/modules/monitor/monitor.c +++ b/src/modules/monitor/monitor.c @@ -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, diff --git a/src/modules/mouse/mouse.c b/src/modules/mouse/mouse.c index e7207bcfe..1d5eeea88 100644 --- a/src/modules/mouse/mouse.c +++ b/src/modules/mouse/mouse.c @@ -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, diff --git a/src/modules/netio/netio.c b/src/modules/netio/netio.c index 6980f8bd0..9733ee99b 100644 --- a/src/modules/netio/netio.c +++ b/src/modules/netio/netio.c @@ -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, diff --git a/src/modules/opencl/opencl.c b/src/modules/opencl/opencl.c index 8a5cd5879..ad93db8a0 100644 --- a/src/modules/opencl/opencl.c +++ b/src/modules/opencl/opencl.c @@ -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, diff --git a/src/modules/opengl/opengl.c b/src/modules/opengl/opengl.c index a83e8d9c0..43ef88d44 100644 --- a/src/modules/opengl/opengl.c +++ b/src/modules/opengl/opengl.c @@ -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, diff --git a/src/modules/os/os.c b/src/modules/os/os.c index c2e17e837..9bcb13387 100644 --- a/src/modules/os/os.c +++ b/src/modules/os/os.c @@ -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, diff --git a/src/modules/packages/packages.c b/src/modules/packages/packages.c index 917aea944..a5d61ee72 100644 --- a/src/modules/packages/packages.c +++ b/src/modules/packages/packages.c @@ -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, diff --git a/src/modules/physicaldisk/physicaldisk.c b/src/modules/physicaldisk/physicaldisk.c index 53ca43a27..79be411cb 100644 --- a/src/modules/physicaldisk/physicaldisk.c +++ b/src/modules/physicaldisk/physicaldisk.c @@ -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, diff --git a/src/modules/physicalmemory/physicalmemory.c b/src/modules/physicalmemory/physicalmemory.c index 340bc551e..e36ceaa64 100644 --- a/src/modules/physicalmemory/physicalmemory.c +++ b/src/modules/physicalmemory/physicalmemory.c @@ -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, diff --git a/src/modules/player/player.c b/src/modules/player/player.c index 6d6dea813..2c7aaac97 100644 --- a/src/modules/player/player.c +++ b/src/modules/player/player.c @@ -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, diff --git a/src/modules/poweradapter/poweradapter.c b/src/modules/poweradapter/poweradapter.c index de2a36e39..8f33d6ae8 100644 --- a/src/modules/poweradapter/poweradapter.c +++ b/src/modules/poweradapter/poweradapter.c @@ -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, diff --git a/src/modules/processes/processes.c b/src/modules/processes/processes.c index bf272e97d..0c79b4d27 100644 --- a/src/modules/processes/processes.c +++ b/src/modules/processes/processes.c @@ -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, diff --git a/src/modules/publicip/publicip.c b/src/modules/publicip/publicip.c index 16bdfd6ac..2dbee34ba 100644 --- a/src/modules/publicip/publicip.c +++ b/src/modules/publicip/publicip.c @@ -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, diff --git a/src/modules/separator/separator.c b/src/modules/separator/separator.c index 16171ac50..e6bd66aa7 100644 --- a/src/modules/separator/separator.c +++ b/src/modules/separator/separator.c @@ -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, diff --git a/src/modules/shell/shell.c b/src/modules/shell/shell.c index 58853696e..0c9d15274 100644 --- a/src/modules/shell/shell.c +++ b/src/modules/shell/shell.c @@ -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, diff --git a/src/modules/sound/sound.c b/src/modules/sound/sound.c index 008671d1a..1f948ac95 100644 --- a/src/modules/sound/sound.c +++ b/src/modules/sound/sound.c @@ -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, diff --git a/src/modules/swap/swap.c b/src/modules/swap/swap.c index 45aa00683..ede68f3f7 100644 --- a/src/modules/swap/swap.c +++ b/src/modules/swap/swap.c @@ -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, diff --git a/src/modules/terminal/terminal.c b/src/modules/terminal/terminal.c index 852fe43e3..febbfba3e 100644 --- a/src/modules/terminal/terminal.c +++ b/src/modules/terminal/terminal.c @@ -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, diff --git a/src/modules/terminalfont/terminalfont.c b/src/modules/terminalfont/terminalfont.c index 9949ab533..837e5ac3b 100644 --- a/src/modules/terminalfont/terminalfont.c +++ b/src/modules/terminalfont/terminalfont.c @@ -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, diff --git a/src/modules/terminalsize/terminalsize.c b/src/modules/terminalsize/terminalsize.c index e89155b42..f36ec7d5b 100644 --- a/src/modules/terminalsize/terminalsize.c +++ b/src/modules/terminalsize/terminalsize.c @@ -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, diff --git a/src/modules/terminaltheme/terminaltheme.c b/src/modules/terminaltheme/terminaltheme.c index a0f561fa1..cc4e901e5 100644 --- a/src/modules/terminaltheme/terminaltheme.c +++ b/src/modules/terminaltheme/terminaltheme.c @@ -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, diff --git a/src/modules/theme/theme.c b/src/modules/theme/theme.c index 48975e5c9..ca78bc7c1 100644 --- a/src/modules/theme/theme.c +++ b/src/modules/theme/theme.c @@ -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, diff --git a/src/modules/title/title.c b/src/modules/title/title.c index 3f033d856..dc5ad2920 100644 --- a/src/modules/title/title.c +++ b/src/modules/title/title.c @@ -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, diff --git a/src/modules/tpm/tpm.c b/src/modules/tpm/tpm.c index 64df1ff66..b29a240aa 100644 --- a/src/modules/tpm/tpm.c +++ b/src/modules/tpm/tpm.c @@ -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, diff --git a/src/modules/uptime/uptime.c b/src/modules/uptime/uptime.c index 224725ed7..fa2b11d8a 100644 --- a/src/modules/uptime/uptime.c +++ b/src/modules/uptime/uptime.c @@ -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, diff --git a/src/modules/users/users.c b/src/modules/users/users.c index 435c35ac1..f1137b1c1 100644 --- a/src/modules/users/users.c +++ b/src/modules/users/users.c @@ -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, diff --git a/src/modules/version/version.c b/src/modules/version/version.c index d7db250b5..6b86e0dbd 100644 --- a/src/modules/version/version.c +++ b/src/modules/version/version.c @@ -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, diff --git a/src/modules/vulkan/vulkan.c b/src/modules/vulkan/vulkan.c index f74c15c34..f67f549a9 100644 --- a/src/modules/vulkan/vulkan.c +++ b/src/modules/vulkan/vulkan.c @@ -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, diff --git a/src/modules/wallpaper/wallpaper.c b/src/modules/wallpaper/wallpaper.c index 997c2473a..8635bf325 100644 --- a/src/modules/wallpaper/wallpaper.c +++ b/src/modules/wallpaper/wallpaper.c @@ -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, diff --git a/src/modules/weather/weather.c b/src/modules/weather/weather.c index 03761d391..aef1e26e9 100644 --- a/src/modules/weather/weather.c +++ b/src/modules/weather/weather.c @@ -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, diff --git a/src/modules/wifi/wifi.c b/src/modules/wifi/wifi.c index 6f52c0271..ec5aaf18f 100644 --- a/src/modules/wifi/wifi.c +++ b/src/modules/wifi/wifi.c @@ -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, diff --git a/src/modules/wm/wm.c b/src/modules/wm/wm.c index cb3a64232..46a73e4a4 100644 --- a/src/modules/wm/wm.c +++ b/src/modules/wm/wm.c @@ -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, diff --git a/src/modules/wmtheme/wmtheme.c b/src/modules/wmtheme/wmtheme.c index a3830dace..f5d425f51 100644 --- a/src/modules/wmtheme/wmtheme.c +++ b/src/modules/wmtheme/wmtheme.c @@ -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, diff --git a/src/modules/zpool/zpool.c b/src/modules/zpool/zpool.c index ba110a607..b88b6c7a0 100644 --- a/src/modules/zpool/zpool.c +++ b/src/modules/zpool/zpool.c @@ -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,