mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:14:37 +02:00
Global: improve support of --help *-format
Also fix some bugs found when refactoring
This commit is contained in:
+4
-1
@@ -18,6 +18,7 @@ typedef struct FFModuleBaseInfo
|
||||
void (*parseJsonObject)(void* options, struct yyjson_val *module);
|
||||
void (*printModule)(void* options);
|
||||
void (*generateJson)(void* options, struct yyjson_mut_doc* doc, struct yyjson_mut_val* module);
|
||||
void (*printHelpFormat)(void);
|
||||
} FFModuleBaseInfo;
|
||||
|
||||
static inline void ffOptionInitModuleBaseInfo(
|
||||
@@ -26,7 +27,8 @@ static inline void ffOptionInitModuleBaseInfo(
|
||||
void* parseCommandOptions, // bool (*const parseCommandOptions)(void* options, const char* key, const char* value)
|
||||
void* parseJsonObject, // void (*const parseJsonObject)(void* options, yyjson_val *module)
|
||||
void* printModule, // void (*const printModule)(void* options)
|
||||
void* generateJson // void (*const generateJson)(void* options, yyjson_mut_doc* doc, yyjson_mut_val* obj)
|
||||
void* generateJson, // void (*const generateJson)(void* options, yyjson_mut_doc* doc, yyjson_mut_val* obj)
|
||||
void (*printHelpFormat)(void)
|
||||
)
|
||||
{
|
||||
baseInfo->name = name;
|
||||
@@ -34,6 +36,7 @@ static inline void ffOptionInitModuleBaseInfo(
|
||||
baseInfo->parseJsonObject = (__typeof__(baseInfo->parseJsonObject)) parseJsonObject;
|
||||
baseInfo->printModule = (__typeof__(baseInfo->printModule)) printModule;
|
||||
baseInfo->generateJson = (__typeof__(baseInfo->generateJson)) generateJson;
|
||||
baseInfo->printHelpFormat = printHelpFormat;
|
||||
}
|
||||
|
||||
typedef struct FFModuleArgs
|
||||
|
||||
@@ -132,3 +132,18 @@ void ffPrintCharTimes(char c, uint32_t times)
|
||||
if(remaining > 0)
|
||||
fwrite(str, 1, remaining, stdout);
|
||||
}
|
||||
|
||||
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[])
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreateS(name);
|
||||
ffStrbufLowerCase(&buffer);
|
||||
printf("--%s-format:\n", buffer.chars);
|
||||
printf("Sets the format string for %s output.\n", name);
|
||||
puts("To see how a format string is constructed, take a look at \"fastfetch --help format\".");
|
||||
puts("The following values are passed:");
|
||||
|
||||
for(unsigned i = 0; i < numArgs; i++)
|
||||
printf(" {%u}: %s\n", i, args[i]);
|
||||
|
||||
printf("The default is something similar to \"%s\".\n", def);
|
||||
}
|
||||
|
||||
@@ -25,4 +25,6 @@ FF_C_PRINTF(4, 5) void ffPrintError(const char* moduleName, uint8_t moduleIndex,
|
||||
void ffPrintColor(const FFstrbuf* colorValue);
|
||||
void ffPrintCharTimes(char c, uint32_t times);
|
||||
|
||||
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
|
||||
|
||||
#endif
|
||||
|
||||
+18
-495
@@ -21,22 +21,23 @@
|
||||
|
||||
#include "modules/modules.h"
|
||||
|
||||
static void constructAndPrintCommandHelpFormat(const char* name, const char* def, uint32_t numArgs, ...)
|
||||
static void printCommandFormatHelp(const char* command)
|
||||
{
|
||||
va_list argp;
|
||||
va_start(argp, numArgs);
|
||||
FF_STRBUF_AUTO_DESTROY type = ffStrbufCreateNS((uint32_t) (strlen(command) - strlen("-format")), command);
|
||||
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(command[0]) - 'A']; *modules; ++modules)
|
||||
{
|
||||
FFModuleBaseInfo* baseInfo = *modules;
|
||||
if (ffStrbufIgnCaseEqualS(&type, baseInfo->name))
|
||||
{
|
||||
if (baseInfo->printHelpFormat)
|
||||
baseInfo->printHelpFormat();
|
||||
else
|
||||
fprintf(stderr, "Error: Module '%s' doesn't support output formatting\n", baseInfo->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
printf("--%s-format:\n", name);
|
||||
printf("Sets the format string for %s output.\n", name);
|
||||
puts("To see how a format string is constructed, take a look at \"fastfetch --help format\".");
|
||||
puts("The following values are passed:");
|
||||
|
||||
for(uint32_t i = 1; i <= numArgs; i++)
|
||||
printf(" {%u}: %s\n", i, va_arg(argp, const char*));
|
||||
|
||||
printf("The default is something similar to \"%s\".\n", def);
|
||||
|
||||
va_end(argp);
|
||||
fprintf(stderr, "Error: Module '%s' is not supported\n", type.chars);
|
||||
}
|
||||
|
||||
static inline void printCommandHelp(const char* command)
|
||||
@@ -49,488 +50,10 @@ static inline void printCommandHelp(const char* command)
|
||||
puts(FASTFETCH_DATATEXT_HELP_FORMAT);
|
||||
else if(ffStrEqualsIgnCase(command, "load-config") || ffStrEqualsIgnCase(command, "config"))
|
||||
puts(FASTFETCH_DATATEXT_HELP_CONFIG);
|
||||
else if(ffStrEqualsIgnCase(command, "title-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("title", "{6}{7}{8}", 8,
|
||||
"User name",
|
||||
"Host name",
|
||||
"Home directory",
|
||||
"Executable path of current process",
|
||||
"User's default shell",
|
||||
"User name (colored)",
|
||||
"@ symbol (colored)",
|
||||
"Host name (colored)"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "os-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("os", "{3} {12}", 12,
|
||||
"System name (typically just Linux)",
|
||||
"Name of the OS",
|
||||
"Pretty name of the OS",
|
||||
"ID of the OS",
|
||||
"ID like of the OS",
|
||||
"Variant of the OS",
|
||||
"Variant ID of the OS",
|
||||
"Version of the OS",
|
||||
"Version ID of the OS",
|
||||
"Version codename of the OS",
|
||||
"Build ID of the OS",
|
||||
"Architecture of the OS"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "host-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("host", "{2} {3}", 8,
|
||||
"product family",
|
||||
"product name",
|
||||
"product version",
|
||||
"product sku",
|
||||
"chassis type",
|
||||
"chassis vendor",
|
||||
"chassis version",
|
||||
"sys vendor"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "bios-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("bios", "{4} ({2})", 4,
|
||||
"bios date",
|
||||
"bios release",
|
||||
"bios vendor",
|
||||
"bios version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "board-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("board", "{1} ({3})", 3,
|
||||
"board name",
|
||||
"board vendor",
|
||||
"board version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "chassis-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("chassis", "{1}", 3,
|
||||
"chassis type",
|
||||
"chassis vendor",
|
||||
"chassis version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "kernel-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("kernel", "{2}", 3,
|
||||
"Kernel sysname",
|
||||
"Kernel release",
|
||||
"Kernel version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "uptime-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("uptime", "{1} days {2} hours {3} mins", 4,
|
||||
"Days",
|
||||
"Hours",
|
||||
"Minutes",
|
||||
"Seconds"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "processes-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("processes", "{1}", 1,
|
||||
"Count"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "packages-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("packages", "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (port), {20} (scoop), {21} (choco), {22} (pkgtool), {23} (paludis), {24} (winget)", 24,
|
||||
"Number of all packages",
|
||||
"Number of pacman packages",
|
||||
"Pacman branch on manjaro",
|
||||
"Number of dpkg packages",
|
||||
"Number of rpm packages",
|
||||
"Number of emerge packages",
|
||||
"Number of eopkg packages",
|
||||
"Number of xbps packages",
|
||||
"Number of nix-system packages",
|
||||
"Number of nix-user packages",
|
||||
"Number of nix-default packages",
|
||||
"Number of apk packages",
|
||||
"Number of pkg packages",
|
||||
"Number of flatpak-system packages",
|
||||
"Number of flatpak-user packages",
|
||||
"Number of snap packages",
|
||||
"Number of brew packages",
|
||||
"Number of brew-cask packages",
|
||||
"Number of macports packages",
|
||||
"Number of scoop packages",
|
||||
"Number of choco packages",
|
||||
"Number of pkgtool packages",
|
||||
"Number of paludis packages"
|
||||
"Number of winget packages"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "shell-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("shell", "{3} {4}", 6,
|
||||
"Shell process name",
|
||||
"Shell path with exe name",
|
||||
"Shell exe name",
|
||||
"Shell version",
|
||||
"Shell pid",
|
||||
"Shell pretty name"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "display-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("display", "{1}x{2} @ {3}Hz", 8,
|
||||
"Screen width",
|
||||
"Screen height",
|
||||
"Screen refresh rate",
|
||||
"Screen scaled width",
|
||||
"Screen scaled height",
|
||||
"Screen name",
|
||||
"Screen type",
|
||||
"Screen rotation"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "brightness-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("brightness", "{}", 2,
|
||||
"Screen brightness",
|
||||
"Screen name"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "monitor-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("monitor", "{2}x{3} px - {4}x{5} mm ({6} inches, {7} ppi)", 7,
|
||||
"Display name",
|
||||
"Display native resolution width in pixels",
|
||||
"Display native resolution height in pixels",
|
||||
"Display physical width in millimeters",
|
||||
"Display physical height in millimeters",
|
||||
"Display physical diagonal length in inches",
|
||||
"Display physical pixels per inch (PPI)"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "de-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("de", "{2} {3}", 3,
|
||||
"DE process name",
|
||||
"DE pretty name",
|
||||
"DE version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "wm-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wm", "{2} ({3})", 3,
|
||||
"WM process name",
|
||||
"WM pretty name",
|
||||
"WM protocol name"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "wmtheme-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wmtheme", "{1}", 1,
|
||||
"WM theme name"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "theme-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("theme", "{1}", 1,
|
||||
"Combined themes"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "icons-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("icons", "{1}", 1,
|
||||
"Combined icons"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "wallpaper-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wallpaper", "{1}", 1,
|
||||
"Wallpaper image file"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "font-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("font", "{1} [QT], {2} [GTK2], {3} [GTK3], {4} [GTK4]", 4,
|
||||
"Font 1",
|
||||
"Font 2",
|
||||
"Font 3",
|
||||
"Font 4"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "cursor-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("cursor", "{1}", 2,
|
||||
"Cursor theme",
|
||||
"Cursor size"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "terminal-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("terminal", "{5} {6}", 6,
|
||||
"Terminal process name",
|
||||
"Terminal path with exe name",
|
||||
"Terminal exe name",
|
||||
"Terminal pid",
|
||||
"Terminal pretty name",
|
||||
"Terminal version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "terminalfont-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("terminalfont", "{1}", 4,
|
||||
"Terminal font",
|
||||
"Terminal font name",
|
||||
"Termianl font size",
|
||||
"Terminal font styles"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "cpu-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("cpu", "{1} ({5}) @ {7} GHz", 8,
|
||||
"Name",
|
||||
"Vendor",
|
||||
"Physical core count",
|
||||
"Logical core count",
|
||||
"Online core count",
|
||||
"Min frequency",
|
||||
"Max frequency",
|
||||
"Temperature"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "cpuusage-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("cpuusage", "{1}", 1,
|
||||
"CPU usage without percent mark"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "gpu-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("gpu", "{1} {2}", 6,
|
||||
"GPU vendor",
|
||||
"GPU name",
|
||||
"GPU driver",
|
||||
"GPU temperature",
|
||||
"GPU core count",
|
||||
"GPU type"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "memory-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("memory", "{1} / {2} ({3})", 3,
|
||||
"Used size",
|
||||
"Total size",
|
||||
"Percentage used"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "swap-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("swap", "{1} / {2} ({3})", 3,
|
||||
"Used size",
|
||||
"Total size",
|
||||
"Percentage used"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "disk-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("disk", "{1} / {2} ({3}) - {9}", 9,
|
||||
"Size used",
|
||||
"Size total",
|
||||
"Size percentage",
|
||||
"Files used",
|
||||
"Files total",
|
||||
"Files percentage",
|
||||
"True if external volume",
|
||||
"True if hidden volume",
|
||||
"Filesystem"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "battery-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("battery", "{}%, {}", 5,
|
||||
"Battery manufactor",
|
||||
"Battery model",
|
||||
"Battery technology",
|
||||
"Battery capacity",
|
||||
"Battery status"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "poweradapter-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("poweradapter", "{}%, {}", 5,
|
||||
"PowerAdapter watts",
|
||||
"PowerAdapter name",
|
||||
"PowerAdapter manufacturer",
|
||||
"PowerAdapter model",
|
||||
"PowerAdapter description"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "lm-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("lm", "{1} {3} ({2})", 3,
|
||||
"LM service",
|
||||
"LM type",
|
||||
"LM version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "locale-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("locale", "{1}", 1,
|
||||
"Locale code"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "localip-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("localip", "{1}{5}", 5,
|
||||
"Local IPv4 address",
|
||||
"Local IPv6 address",
|
||||
"Physical (MAC) address",
|
||||
"Interface name",
|
||||
"Is default route"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "publicip-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("publicip", "{1} ({2})", 2,
|
||||
"Public IP address",
|
||||
"Location"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "netio-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("netio", "{1} (IN) - {2} (OUT){4}", 4,
|
||||
"Size of data received per second (formatted)",
|
||||
"Size of data sent per second (formatted)",
|
||||
"Interface name",
|
||||
"Is default route"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "wifi-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wifi", "{4} - {10}", 10,
|
||||
"Interface description",
|
||||
"Interface status",
|
||||
"Connection status",
|
||||
"Connection SSID",
|
||||
"Connection mac address",
|
||||
"Connection protocol",
|
||||
"Connection signal quality (percentage)",
|
||||
"Connection RX rate",
|
||||
"Connection TX rate",
|
||||
"Connection Security algorithm"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "player-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("player", "{}", 4,
|
||||
"Pretty player name",
|
||||
"Player name",
|
||||
"Player Identifier",
|
||||
"URL name"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "media-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("media", "{3} - {1}", 4,
|
||||
"Pretty media name",
|
||||
"Media name",
|
||||
"Artist name",
|
||||
"Album name"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "datetime-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("[date][time]", "{1}-{4}-{11} {14}:{18}:{20}", 20,
|
||||
"year",
|
||||
"last two digits of year",
|
||||
"month",
|
||||
"month with leading zero",
|
||||
"month name",
|
||||
"month name short",
|
||||
"week number on year",
|
||||
"weekday",
|
||||
"weekday short",
|
||||
"day in year",
|
||||
"day in month",
|
||||
"day in Week",
|
||||
"hour",
|
||||
"hour with leading zero",
|
||||
"hour 12h format",
|
||||
"hour 12h format with leading zero",
|
||||
"minute",
|
||||
"minute with leading zero",
|
||||
"second",
|
||||
"second with leading zero"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "version-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("version", "{1} {2}{3} ({5})", 9,
|
||||
"Project name",
|
||||
"Version",
|
||||
"Version tweak",
|
||||
"Build type (debug or release)",
|
||||
"Architecture",
|
||||
"CMake build type (Debug, Release, RelWithDebInfo, MinSizeRel)",
|
||||
"Date time when compiling",
|
||||
"Compiler used"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "vulkan-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("vulkan", "{} (driver), {} (api version)", 3,
|
||||
"Driver name",
|
||||
"API version",
|
||||
"Conformance version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "opengl-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("opengl", "{1}", 4,
|
||||
"version",
|
||||
"renderer",
|
||||
"vendor",
|
||||
"shading language version"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "opencl-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("opencl", "{}", 3,
|
||||
"version",
|
||||
"device",
|
||||
"vendor"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "bluetooth-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("bluetooth", "{1} (4%)", 4,
|
||||
"Name",
|
||||
"Address",
|
||||
"Type",
|
||||
"Battery percentage"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "sound-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("sound", "{2} ({3}%)", 4,
|
||||
"Main",
|
||||
"Name",
|
||||
"Volume",
|
||||
"Identifier"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "gamepad-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("gamepad", "{1}", 2,
|
||||
"Name",
|
||||
"Identifier"
|
||||
);
|
||||
}
|
||||
else if(isalpha(command[0]) && ffStrEndsWithIgnCase(command, "-format")) // x-format
|
||||
printCommandFormatHelp(command);
|
||||
else
|
||||
fprintf(stderr, "No specific help for command '%s' provided\n", command);
|
||||
fprintf(stderr, "Error: No specific help for command '%s' provided\n", command);
|
||||
}
|
||||
|
||||
static void listAvailablePresets(void)
|
||||
|
||||
@@ -103,7 +103,7 @@ void ffPrintBattery(FFBatteryOptions* options)
|
||||
|
||||
void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BATTERY_MODULE_NAME, ffParseBatteryCommandOptions, ffParseBatteryJsonObject, ffPrintBattery, ffGenerateBatteryJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BATTERY_MODULE_NAME, ffParseBatteryCommandOptions, ffParseBatteryJsonObject, ffPrintBattery, ffGenerateBatteryJson, ffPrintBatteryHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->temp = false;
|
||||
|
||||
@@ -208,3 +208,14 @@ void ffGenerateBatteryJson(FFBatteryOptions* options, yyjson_mut_doc* doc, yyjso
|
||||
ffStrbufDestroy(&battery->status);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintBatteryHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_BATTERY_MODULE_NAME, "{4}, {5}", FF_BATTERY_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Battery manufactor",
|
||||
"Battery model",
|
||||
"Battery technology",
|
||||
"Battery capacity (percentage)",
|
||||
"Battery status"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,3 +11,4 @@ bool ffParseBatteryCommandOptions(FFBatteryOptions* options, const char* key, co
|
||||
void ffDestroyBatteryOptions(FFBatteryOptions* options);
|
||||
void ffParseBatteryJsonObject(FFBatteryOptions* options, yyjson_val* module);
|
||||
void ffGenerateBatteryJson(FFBatteryOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintBatteryHelpFormat(void);
|
||||
|
||||
+11
-1
@@ -55,7 +55,7 @@ exit:
|
||||
|
||||
void ffInitBiosOptions(FFBiosOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BIOS_MODULE_NAME, ffParseBiosCommandOptions, ffParseBiosJsonObject, ffPrintBios, ffGenerateBiosJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BIOS_MODULE_NAME, ffParseBiosCommandOptions, ffParseBiosJsonObject, ffPrintBios, ffGenerateBiosJson, ffPrintBiosHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -125,3 +125,13 @@ exit:
|
||||
ffStrbufDestroy(&bios.vendor);
|
||||
ffStrbufDestroy(&bios.version);
|
||||
}
|
||||
|
||||
void ffPrintBiosHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_BIOS_MODULE_NAME, "{4} ({2})", FF_BIOS_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"bios date",
|
||||
"bios release",
|
||||
"bios vendor",
|
||||
"bios version"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseBiosCommandOptions(FFBiosOptions* options, const char* key, const ch
|
||||
void ffDestroyBiosOptions(FFBiosOptions* options);
|
||||
void ffParseBiosJsonObject(FFBiosOptions* options, yyjson_val* module);
|
||||
void ffGenerateBiosJson(FFBiosOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintBiosHelpFormat(void);
|
||||
|
||||
@@ -75,7 +75,7 @@ void ffPrintBluetooth(FFBluetoothOptions* options)
|
||||
|
||||
void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BLUETOOTH_MODULE_NAME, ffParseBluetoothCommandOptions, ffParseBluetoothJsonObject, ffPrintBluetooth, ffGenerateBluetoothJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BLUETOOTH_MODULE_NAME, ffParseBluetoothCommandOptions, ffParseBluetoothJsonObject, ffPrintBluetooth, ffGenerateBluetoothJson, ffPrintBluetoothHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->showDisconnected = false;
|
||||
}
|
||||
@@ -156,3 +156,13 @@ void ffGenerateBluetoothJson(FF_MAYBE_UNUSED FFBluetoothOptions* options, yyjson
|
||||
ffStrbufDestroy(&device->address);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintBluetoothHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_BLUETOOTH_MODULE_NAME, "{1} ({4})", FF_BLUETOOTH_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Name",
|
||||
"Address",
|
||||
"Type",
|
||||
"Battery percentage"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseBluetoothCommandOptions(FFBluetoothOptions* options, const char* key
|
||||
void ffDestroyBluetoothOptions(FFBluetoothOptions* options);
|
||||
void ffParseBluetoothJsonObject(FFBluetoothOptions* options, yyjson_val* module);
|
||||
void ffGenerateBluetoothJson(FFBluetoothOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintBluetoothHelpFormat(void);
|
||||
|
||||
@@ -51,7 +51,7 @@ exit:
|
||||
|
||||
void ffInitBoardOptions(FFBoardOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BOARD_MODULE_NAME, ffParseBoardCommandOptions, ffParseBoardJsonObject, ffPrintBoard, NULL);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BOARD_MODULE_NAME, ffParseBoardCommandOptions, ffParseBoardJsonObject, ffPrintBoard, ffGenerateBoardJson, ffPrintBoardHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -118,3 +118,12 @@ exit:
|
||||
ffStrbufDestroy(&board.vendor);
|
||||
ffStrbufDestroy(&board.version);
|
||||
}
|
||||
|
||||
void ffPrintBoardHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_BOARD_MODULE_NAME, "{1} ({3})", FF_BOARD_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"board name",
|
||||
"board vendor",
|
||||
"board version"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseBoardCommandOptions(FFBoardOptions* options, const char* key, const
|
||||
void ffDestroyBoardOptions(FFBoardOptions* options);
|
||||
void ffParseBoardJsonObject(FFBoardOptions* options, yyjson_val* module);
|
||||
void ffGenerateBoardJson(FFBoardOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintBoardHelpFormat(void);
|
||||
|
||||
@@ -9,7 +9,7 @@ void ffPrintBreak(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
|
||||
void ffInitBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BREAK_MODULE_NAME, ffParseBreakCommandOptions, ffParseBreakJsonObject, ffPrintBreak, NULL);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BREAK_MODULE_NAME, ffParseBreakCommandOptions, ffParseBreakJsonObject, ffPrintBreak, NULL, NULL);
|
||||
}
|
||||
|
||||
bool ffParseBreakCommandOptions(FF_MAYBE_UNUSED FFBreakOptions* options, FF_MAYBE_UNUSED const char* key, FF_MAYBE_UNUSED const char* value)
|
||||
|
||||
@@ -86,7 +86,7 @@ void ffPrintBrightness(FFBrightnessOptions* options)
|
||||
|
||||
void ffInitBrightnessOptions(FFBrightnessOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BRIGHTNESS_MODULE_NAME, ffParseBrightnessCommandOptions, ffParseBrightnessJsonObject, ffPrintBrightness, ffGenerateBrightnessJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_BRIGHTNESS_MODULE_NAME, ffParseBrightnessCommandOptions, ffParseBrightnessJsonObject, ffPrintBrightness, ffGenerateBrightnessJson, ffPrintBrightnessHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -157,3 +157,14 @@ void ffGenerateBrightnessJson(FF_MAYBE_UNUSED FFBrightnessOptions* options, yyjs
|
||||
ffStrbufDestroy(&item->name);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintBrightnessHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_BRIGHTNESS_MODULE_NAME, "{1}", FF_BRIGHTNESS_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Screen brightness (percentage)",
|
||||
"Screen name",
|
||||
"Maximum brightness value",
|
||||
"Minimum brightness value",
|
||||
"Current brightness value",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseBrightnessCommandOptions(FFBrightnessOptions* options, const char* k
|
||||
void ffDestroyBrightnessOptions(FFBrightnessOptions* options);
|
||||
void ffParseBrightnessJsonObject(FFBrightnessOptions* options, yyjson_val* module);
|
||||
void ffGenerateBrightnessJson(FFBrightnessOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintBrightnessHelpFormat(void);
|
||||
|
||||
@@ -52,7 +52,7 @@ exit:
|
||||
|
||||
void ffInitChassisOptions(FFChassisOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CHASSIS_MODULE_NAME, ffParseChassisCommandOptions, ffParseChassisJsonObject, ffPrintChassis, ffGenerateChassisJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CHASSIS_MODULE_NAME, ffParseChassisCommandOptions, ffParseChassisJsonObject, ffPrintChassis, ffGenerateChassisJson, ffPrintChassisHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -119,3 +119,12 @@ exit:
|
||||
ffStrbufDestroy(&result.vendor);
|
||||
ffStrbufDestroy(&result.version);
|
||||
}
|
||||
|
||||
void ffPrintChassisHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_CHASSIS_MODULE_NAME, "{1}", FF_CHASSIS_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"chassis type",
|
||||
"chassis vendor",
|
||||
"chassis version"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseChassisCommandOptions(FFChassisOptions* options, const char* key, co
|
||||
void ffDestroyChassisOptions(FFChassisOptions* options);
|
||||
void ffParseChassisJsonObject(FFChassisOptions* options, yyjson_val* module);
|
||||
void ffGenerateChassisJson(FFChassisOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintChassisHelpFormat(void);
|
||||
|
||||
@@ -57,7 +57,7 @@ void ffPrintColors(FFColorsOptions* options)
|
||||
|
||||
void ffInitColorsOptions(FFColorsOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_COLORS_MODULE_NAME, ffParseColorsCommandOptions, ffParseColorsJsonObject, ffPrintColors, NULL);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_COLORS_MODULE_NAME, ffParseColorsCommandOptions, ffParseColorsJsonObject, ffPrintColors, NULL, NULL);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
||||
options->symbol = FF_COLORS_SYMBOL_BLOCK;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "modules/command/command.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_COMMAND_NUM_FORMAT_ARGS 1
|
||||
|
||||
void ffPrintCommand(FFCommandOptions* options)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY result = ffStrbufCreate();
|
||||
@@ -30,13 +32,22 @@ void ffPrintCommand(FFCommandOptions* options)
|
||||
return;
|
||||
}
|
||||
|
||||
ffPrintLogoAndKey(FF_COMMAND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
ffStrbufPutTo(&result, stdout);
|
||||
if (options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_COMMAND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
ffStrbufPutTo(&result, stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormat(FF_COMMAND_MODULE_NAME, 0, &options->moduleArgs, FF_COMMAND_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitCommandOptions(FFCommandOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_COMMAND_MODULE_NAME, ffParseCommandCommandOptions, ffParseCommandJsonObject, ffPrintCommand, ffGenerateCommandJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_COMMAND_MODULE_NAME, ffParseCommandCommandOptions, ffParseCommandJsonObject, ffPrintCommand, ffGenerateCommandJson, ffPrintCommandHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufInitStatic(&options->shell,
|
||||
@@ -136,3 +147,10 @@ void ffGenerateCommandJson(FF_MAYBE_UNUSED FFCommandOptions* options, yyjson_mut
|
||||
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "result", &result);
|
||||
}
|
||||
|
||||
void ffPrintCommandHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_COMMAND_MODULE_NAME, "{1}", FF_COMMAND_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Command result"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseCommandCommandOptions(FFCommandOptions* options, const char* key, co
|
||||
void ffDestroyCommandOptions(FFCommandOptions* options);
|
||||
void ffParseCommandJsonObject(FFCommandOptions* options, yyjson_val* module);
|
||||
void ffGenerateCommandJson(FFCommandOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintCommandHelpFormat(void);
|
||||
|
||||
+15
-1
@@ -79,7 +79,7 @@ void ffPrintCPU(FFCPUOptions* options)
|
||||
|
||||
void ffInitCPUOptions(FFCPUOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CPU_MODULE_NAME, ffParseCPUCommandOptions, ffParseCPUJsonObject, ffPrintCPU, ffGenerateCPUJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CPU_MODULE_NAME, ffParseCPUCommandOptions, ffParseCPUJsonObject, ffPrintCPU, ffGenerateCPUJson, ffPrintCPUHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->temp = false;
|
||||
}
|
||||
@@ -168,3 +168,17 @@ void ffGenerateCPUJson(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_va
|
||||
ffStrbufDestroy(&cpu.name);
|
||||
ffStrbufDestroy(&cpu.vendor);
|
||||
}
|
||||
|
||||
void ffPrintCPUHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_CPU_MODULE_NAME, "{1} ({5}) @ {7} GHz", FF_CPU_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Name",
|
||||
"Vendor",
|
||||
"Physical core count",
|
||||
"Logical core count",
|
||||
"Online core count",
|
||||
"Min frequency",
|
||||
"Max frequency",
|
||||
"Temperature"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseCPUCommandOptions(FFCPUOptions* options, const char* key, const char
|
||||
void ffDestroyCPUOptions(FFCPUOptions* options);
|
||||
void ffParseCPUJsonObject(FFCPUOptions* options, yyjson_val* module);
|
||||
void ffGenerateCPUJson(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintCPUHelpFormat(void);
|
||||
|
||||
@@ -46,7 +46,7 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
|
||||
|
||||
void ffInitCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CPUUSAGE_MODULE_NAME, ffParseCPUUsageCommandOptions, ffParseCPUUsageJsonObject, ffPrintCPUUsage, ffGenerateCPUUsageJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CPUUSAGE_MODULE_NAME, ffParseCPUUsageCommandOptions, ffParseCPUUsageJsonObject, ffPrintCPUUsage, ffGenerateCPUUsageJson, ffPrintCPUUsageHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -94,3 +94,10 @@ void ffGenerateCPUUsageJson(FF_MAYBE_UNUSED FFCPUUsageOptions* options, yyjson_m
|
||||
}
|
||||
yyjson_mut_obj_add_real(doc, module, "result", percentage);
|
||||
}
|
||||
|
||||
void ffPrintCPUUsageHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_CPUUSAGE_MODULE_NAME, "{1}", FF_CPUUSAGE_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"CPU usage (percentage)"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,3 +12,4 @@ bool ffParseCPUUsageCommandOptions(FFCPUUsageOptions* options, const char* key,
|
||||
void ffDestroyCPUUsageOptions(FFCPUUsageOptions* options);
|
||||
void ffParseCPUUsageJsonObject(FFCPUUsageOptions* options, yyjson_val* module);
|
||||
void ffGenerateCPUUsageJson(FFCPUUsageOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintCPUUsageHelpFormat(void);
|
||||
|
||||
@@ -52,7 +52,7 @@ void ffPrintCursor(FFCursorOptions* options)
|
||||
|
||||
void ffInitCursorOptions(FFCursorOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CURSOR_MODULE_NAME, ffParseCursorCommandOptions, ffParseCursorJsonObject, ffPrintCursor, ffGenerateCursorJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CURSOR_MODULE_NAME, ffParseCursorCommandOptions, ffParseCursorJsonObject, ffPrintCursor, ffGenerateCursorJson, ffPrintCursorHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -111,3 +111,11 @@ void ffGenerateCursorJson(FF_MAYBE_UNUSED FFCursorOptions* options, yyjson_mut_d
|
||||
ffStrbufDestroy(&result.theme);
|
||||
ffStrbufDestroy(&result.size);
|
||||
}
|
||||
|
||||
void ffPrintCursorHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_CURSOR_MODULE_NAME, "{1} ({2}px)", FF_CURSOR_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Cursor theme",
|
||||
"Cursor size"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseCursorCommandOptions(FFCursorOptions* options, const char* key, cons
|
||||
void ffDestroyCursorOptions(FFCursorOptions* options);
|
||||
void ffParseCursorJsonObject(FFCursorOptions* options, yyjson_val* module);
|
||||
void ffGenerateCursorJson(FFCursorOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintCursorHelpFormat(void);
|
||||
|
||||
@@ -19,7 +19,7 @@ void ffPrintCustom(FFCustomOptions* options)
|
||||
|
||||
void ffInitCustomOptions(FFCustomOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CUSTOM_MODULE_NAME, ffParseCustomCommandOptions, ffParseCustomJsonObject, ffPrintCustom, NULL);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CUSTOM_MODULE_NAME, ffParseCustomCommandOptions, ffParseCustomJsonObject, ffPrintCustom, NULL, NULL);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void ffPrintDateTime(FFDateTimeOptions* options)
|
||||
|
||||
void ffInitDateTimeOptions(FFDateTimeOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DATETIME_MODULE_NAME, ffParseDateTimeCommandOptions, ffParseDateTimeJsonObject, ffPrintDateTime, ffGenerateDateTimeJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DATETIME_MODULE_NAME, ffParseDateTimeCommandOptions, ffParseDateTimeJsonObject, ffPrintDateTime, ffGenerateDateTimeJson, ffPrintDateTimeHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -183,3 +183,29 @@ void ffGenerateDateTimeJson(FF_MAYBE_UNUSED FFDateTimeOptions* options, yyjson_m
|
||||
{
|
||||
yyjson_mut_obj_add_uint(doc, module, "result", ffTimeGetNow());
|
||||
}
|
||||
|
||||
void ffPrintDateTimeHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_DATETIME_MODULE_NAME, "{1}-{4}-{11} {14}:{18}:{20}", FF_DATETIME_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"year",
|
||||
"last two digits of year",
|
||||
"month",
|
||||
"month with leading zero",
|
||||
"month name",
|
||||
"month name short",
|
||||
"week number on year",
|
||||
"weekday",
|
||||
"weekday short",
|
||||
"day in year",
|
||||
"day in month",
|
||||
"day in Week",
|
||||
"hour",
|
||||
"hour with leading zero",
|
||||
"hour 12h format",
|
||||
"hour 12h format with leading zero",
|
||||
"minute",
|
||||
"minute with leading zero",
|
||||
"second",
|
||||
"second with leading zero"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseDateTimeCommandOptions(FFDateTimeOptions* options, const char* key,
|
||||
void ffDestroyDateTimeOptions(FFDateTimeOptions* options);
|
||||
void ffParseDateTimeJsonObject(FFDateTimeOptions* options, yyjson_val* module);
|
||||
void ffGenerateDateTimeJson(FFDateTimeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintDateTimeHelpFormat(void);
|
||||
|
||||
+10
-1
@@ -42,7 +42,7 @@ void ffPrintDE(FFDEOptions* options)
|
||||
|
||||
void ffInitDEOptions(FFDEOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DE_MODULE_NAME, ffParseDECommandOptions, ffParseDEJsonObject, ffPrintDE, ffGenerateDEJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DE_MODULE_NAME, ffParseDECommandOptions, ffParseDEJsonObject, ffPrintDE, ffGenerateDEJson, ffPrintDEHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -93,3 +93,12 @@ void ffGenerateDEJson(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc* doc,
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "prettyName", &result->dePrettyName);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &result->deVersion);
|
||||
}
|
||||
|
||||
void ffPrintDEHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_DE_MODULE_NAME, "{2} {3}", FF_DE_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"DE process name",
|
||||
"DE pretty name",
|
||||
"DE version"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseDECommandOptions(FFDEOptions* options, const char* key, const char*
|
||||
void ffDestroyDEOptions(FFDEOptions* options);
|
||||
void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module);
|
||||
void ffGenerateDEJson(FFDEOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintDEHelpFormat(void);
|
||||
|
||||
+16
-1
@@ -218,7 +218,7 @@ void ffPrintDisk(FFDiskOptions* options)
|
||||
|
||||
void ffInitDiskOptions(FFDiskOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DISK_MODULE_NAME, ffParseDiskCommandOptions, ffParseDiskJsonObject, ffPrintDisk, ffGenerateDiskJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DISK_MODULE_NAME, ffParseDiskCommandOptions, ffParseDiskJsonObject, ffPrintDisk, ffGenerateDiskJson, ffPrintDiskHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufInit(&options->folders);
|
||||
@@ -452,3 +452,18 @@ void ffGenerateDiskJson(FFDiskOptions* options, yyjson_mut_doc* doc, yyjson_mut_
|
||||
ffStrbufDestroy(&item->name);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintDiskHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_DISK_MODULE_NAME, "{1} / {2} ({3}) - {9}", FF_DISK_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Size used",
|
||||
"Size total",
|
||||
"Size percentage",
|
||||
"Files used",
|
||||
"Files total",
|
||||
"Files percentage",
|
||||
"True if external volume",
|
||||
"True if hidden volume",
|
||||
"Filesystem"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
|
||||
void ffDestroyDiskOptions(FFDiskOptions* options);
|
||||
void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module);
|
||||
void ffGenerateDiskJson(FFDiskOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintDiskHelpFormat(void);
|
||||
|
||||
@@ -112,7 +112,7 @@ void ffPrintDisplay(FFDisplayOptions* options)
|
||||
|
||||
void ffInitDisplayOptions(FFDisplayOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DISPLAY_MODULE_NAME, ffParseDisplayCommandOptions, ffParseDisplayJsonObject, ffPrintDisplay, ffGenerateDisplayJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_DISPLAY_MODULE_NAME, ffParseDisplayCommandOptions, ffParseDisplayJsonObject, ffPrintDisplay, ffGenerateDisplayJson, ffPrintDisplayHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
|
||||
options->preciseRefreshRate = false;
|
||||
@@ -225,3 +225,17 @@ void ffGenerateDisplayJson(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjson_mut
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintDisplayHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_DISPLAY_MODULE_NAME, "{1}x{2} @ {3}Hz (as {4}x{5}) [{7}]", FF_DISPLAY_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Screen width (in pixels)",
|
||||
"Screen height (in pixels)",
|
||||
"Screen refresh rate (in Hz)",
|
||||
"Screen scaled width (in pixels)",
|
||||
"Screen scaled height (in pixels)",
|
||||
"Screen name",
|
||||
"Screen type (builtin, external or unknown)",
|
||||
"Screen rotation (in degrees)",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseDisplayCommandOptions(FFDisplayOptions* options, const char* key, co
|
||||
void ffDestroyDisplayOptions(FFDisplayOptions* options);
|
||||
void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module);
|
||||
void ffGenerateDisplayJson(FFDisplayOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintDisplayHelpFormat(void);
|
||||
|
||||
+12
-1
@@ -45,7 +45,7 @@ void ffPrintFont(FFFontOptions* options)
|
||||
|
||||
void ffInitFontOptions(FFFontOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_FONT_MODULE_NAME, ffParseFontCommandOptions, ffParseFontJsonObject, ffPrintFont, ffGenerateFontJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_FONT_MODULE_NAME, ffParseFontCommandOptions, ffParseFontJsonObject, ffPrintFont, ffGenerateFontJson, ffPrintFontHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -106,3 +106,14 @@ void ffGenerateFontJson(FF_MAYBE_UNUSED FFFontOptions* options, yyjson_mut_doc*
|
||||
for (uint32_t i = 0; i < FF_DETECT_FONT_NUM_FONTS; ++i)
|
||||
ffStrbufDestroy(&font.fonts[i]);
|
||||
}
|
||||
|
||||
void ffPrintFontHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_FONT_MODULE_NAME, "{5}", FF_FONT_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Font 1",
|
||||
"Font 2",
|
||||
"Font 3",
|
||||
"Font 4",
|
||||
"Combined fonts"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseFontCommandOptions(FFFontOptions* options, const char* key, const ch
|
||||
void ffDestroyFontOptions(FFFontOptions* options);
|
||||
void ffParseFontJsonObject(FFFontOptions* options, yyjson_val* module);
|
||||
void ffGenerateFontJson(FFFontOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintFontHelpFormat(void);
|
||||
|
||||
@@ -51,7 +51,7 @@ void ffPrintGamepad(FFGamepadOptions* options)
|
||||
|
||||
void ffInitGamepadOptions(FFGamepadOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_GAMEPAD_MODULE_NAME, ffParseGamepadCommandOptions, ffParseGamepadJsonObject, ffPrintGamepad, ffGenerateGamepadJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_GAMEPAD_MODULE_NAME, ffParseGamepadCommandOptions, ffParseGamepadJsonObject, ffPrintGamepad, ffGenerateGamepadJson, ffPrintGamepadHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -119,3 +119,11 @@ void ffGenerateGamepadJson(FF_MAYBE_UNUSED FFGamepadOptions* options, yyjson_mut
|
||||
ffStrbufDestroy(&device->name);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintGamepadHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_GAMEPAD_MODULE_NAME, "{1}", FF_GAMEPAD_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Name",
|
||||
"Identifier"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseGamepadCommandOptions(FFGamepadOptions* options, const char* key, co
|
||||
void ffDestroyGamepadOptions(FFGamepadOptions* options);
|
||||
void ffParseGamepadJsonObject(FFGamepadOptions* options, yyjson_val* module);
|
||||
void ffGenerateGamepadJson(FFGamepadOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintGamepadHelpFormat(void);
|
||||
|
||||
+22
-2
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FF_GPU_NUM_FORMAT_ARGS 6
|
||||
#define FF_GPU_NUM_FORMAT_ARGS 10
|
||||
|
||||
static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResult* gpu)
|
||||
{
|
||||
@@ -77,6 +77,10 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
||||
{FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->temperature},
|
||||
{FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, type},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.total},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.used},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.total},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.used},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -121,7 +125,7 @@ void ffPrintGPU(FFGPUOptions* options)
|
||||
|
||||
void ffInitGPUOptions(FFGPUOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_GPU_MODULE_NAME, ffParseGPUCommandOptions, ffParseGPUJsonObject, ffPrintGPU, ffGenerateGPUJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_GPU_MODULE_NAME, ffParseGPUCommandOptions, ffParseGPUJsonObject, ffPrintGPU, ffGenerateGPUJson, ffPrintGPUHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->forceVulkan = false;
|
||||
@@ -277,3 +281,19 @@ void ffGenerateGPUJson(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_va
|
||||
ffStrbufDestroy(&gpu->driver);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintGPUHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_GPU_MODULE_NAME, "{1} {2}", FF_GPU_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"GPU vendor",
|
||||
"GPU name",
|
||||
"GPU driver",
|
||||
"GPU temperature",
|
||||
"GPU core count",
|
||||
"GPU type",
|
||||
"GPU total dedicated memory",
|
||||
"GPU used dedicated memory",
|
||||
"GPU total shared memory",
|
||||
"GPU used shared memory",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseGPUCommandOptions(FFGPUOptions* options, const char* key, const char
|
||||
void ffDestroyGPUOptions(FFGPUOptions* options);
|
||||
void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module);
|
||||
void ffGenerateGPUJson(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintGPUHelpFormat(void);
|
||||
|
||||
+12
-1
@@ -67,7 +67,7 @@ exit:
|
||||
|
||||
void ffInitHostOptions(FFHostOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_HOST_MODULE_NAME, ffParseHostCommandOptions, ffParseHostJsonObject, ffPrintHost, ffGenerateHostJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_HOST_MODULE_NAME, ffParseHostCommandOptions, ffParseHostJsonObject, ffPrintHost, ffGenerateHostJson, ffPrintHostHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -139,3 +139,14 @@ exit:
|
||||
ffStrbufDestroy(&host.productSku);
|
||||
ffStrbufDestroy(&host.sysVendor);
|
||||
}
|
||||
|
||||
void ffPrintHostHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_HOST_MODULE_NAME, "{2} {3}", FF_HOST_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"product family",
|
||||
"product name",
|
||||
"product version",
|
||||
"product sku",
|
||||
"sys vendor"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseHostCommandOptions(FFHostOptions* options, const char* key, const ch
|
||||
void ffDestroyHostOptions(FFHostOptions* options);
|
||||
void ffParseHostJsonObject(FFHostOptions* options, yyjson_val* module);
|
||||
void ffGenerateHostJson(FFHostOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintHostHelpFormat(void);
|
||||
|
||||
@@ -32,7 +32,7 @@ void ffPrintIcons(FFIconsOptions* options)
|
||||
|
||||
void ffInitIconsOptions(FFIconsOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_ICONS_MODULE_NAME, ffParseIconsCommandOptions, ffParseIconsJsonObject, ffPrintIcons, ffGenerateIconsJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_ICONS_MODULE_NAME, ffParseIconsCommandOptions, ffParseIconsJsonObject, ffPrintIcons, ffGenerateIconsJson, ffPrintIconsHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -81,3 +81,10 @@ void ffGenerateIconsJson(FF_MAYBE_UNUSED FFIconsOptions* options, yyjson_mut_doc
|
||||
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "result", &icons);
|
||||
}
|
||||
|
||||
void ffPrintIconsHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_ICONS_MODULE_NAME, "{1}", FF_ICONS_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Combined icons"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseIconsCommandOptions(FFIconsOptions* options, const char* key, const
|
||||
void ffDestroyIconsOptions(FFIconsOptions* options);
|
||||
void ffParseIconsJsonObject(FFIconsOptions* options, yyjson_val* module);
|
||||
void ffGenerateIconsJson(FFIconsOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintIconsHelpFormat(void);
|
||||
|
||||
@@ -32,7 +32,7 @@ void ffPrintKernel(FFKernelOptions* options)
|
||||
|
||||
void ffInitKernelOptions(FFKernelOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_KERNEL_MODULE_NAME, ffParseKernelCommandOptions, ffParseKernelJsonObject, ffPrintKernel, ffGenerateKernelJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_KERNEL_MODULE_NAME, ffParseKernelCommandOptions, ffParseKernelJsonObject, ffPrintKernel, ffGenerateKernelJson, ffPrintKernelHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -77,3 +77,12 @@ void ffGenerateKernelJson(FF_MAYBE_UNUSED FFKernelOptions* options, yyjson_mut_d
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &instance.state.platform.systemVersion);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "displayVersion", &instance.state.platform.systemDisplayVersion);
|
||||
}
|
||||
|
||||
void ffPrintKernelHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_KERNEL_MODULE_NAME, "{2}", FF_KERNEL_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Kernel sysname",
|
||||
"Kernel release",
|
||||
"Kernel version"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseKernelCommandOptions(FFKernelOptions* options, const char* key, cons
|
||||
void ffDestroyKernelOptions(FFKernelOptions* options);
|
||||
void ffParseKernelJsonObject(FFKernelOptions* options, yyjson_val* module);
|
||||
void ffGenerateKernelJson(FFKernelOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintKernelHelpFormat(void);
|
||||
|
||||
+10
-1
@@ -51,7 +51,7 @@ void ffPrintLM(FFLMOptions* options)
|
||||
|
||||
void ffInitLMOptions(FFLMOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LM_MODULE_NAME, ffParseLMCommandOptions, ffParseLMJsonObject, ffPrintLM, NULL);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LM_MODULE_NAME, ffParseLMCommandOptions, ffParseLMJsonObject, ffPrintLM, ffGenerateLMJson, ffPrintLMHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -117,3 +117,12 @@ exit:
|
||||
ffStrbufDestroy(&result.type);
|
||||
ffStrbufDestroy(&result.version);
|
||||
}
|
||||
|
||||
void ffPrintLMHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_LM_MODULE_NAME, "{1} {3} ({2})", FF_LM_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"LM service",
|
||||
"LM type",
|
||||
"LM version"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseLMCommandOptions(FFLMOptions* options, const char* key, const char*
|
||||
void ffDestroyLMOptions(FFLMOptions* options);
|
||||
void ffParseLMJsonObject(FFLMOptions* options, yyjson_val* module);
|
||||
void ffGenerateLMJson(FFLMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintLMHelpFormat(void);
|
||||
|
||||
@@ -32,7 +32,7 @@ void ffPrintLocale(FFLocaleOptions* options)
|
||||
|
||||
void ffInitLocaleOptions(FFLocaleOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LOCALE_MODULE_NAME, ffParseLocaleCommandOptions, ffParseLocaleJsonObject, ffPrintLocale, ffGenerateLocaleJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LOCALE_MODULE_NAME, ffParseLocaleCommandOptions, ffParseLocaleJsonObject, ffPrintLocale, ffGenerateLocaleJson, ffPrintLocaleHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -81,3 +81,10 @@ void ffGenerateLocaleJson(FF_MAYBE_UNUSED FFLocaleOptions* options, yyjson_mut_d
|
||||
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "result", &locale);
|
||||
}
|
||||
|
||||
void ffPrintLocaleHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_LOCALE_MODULE_NAME, "{1}", FF_LOCALE_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Locale code"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseLocaleCommandOptions(FFLocaleOptions* options, const char* key, cons
|
||||
void ffDestroyLocaleOptions(FFLocaleOptions* options);
|
||||
void ffParseLocaleJsonObject(FFLocaleOptions* options, yyjson_val* module);
|
||||
void ffGenerateLocaleJson(FFLocaleOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintLocaleHelpFormat(void);
|
||||
|
||||
@@ -133,7 +133,7 @@ void ffPrintLocalIp(FFLocalIpOptions* options)
|
||||
|
||||
void ffInitLocalIpOptions(FFLocalIpOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LOCALIP_MODULE_NAME, ffParseLocalIpCommandOptions, ffParseLocalIpJsonObject, ffPrintLocalIp, ffGenerateLocalIpJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_LOCALIP_MODULE_NAME, ffParseLocalIpCommandOptions, ffParseLocalIpJsonObject, ffPrintLocalIp, ffGenerateLocalIpJson, ffPrintLocalIpHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->showType = FF_LOCALIP_TYPE_IPV4_BIT;
|
||||
@@ -326,3 +326,14 @@ exit:
|
||||
ffStrbufDestroy(&ip->mac);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintLocalIpHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_LOCALIP_MODULE_NAME, "{1}", FF_LOCALIP_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Local IPv4 address",
|
||||
"Local IPv6 address",
|
||||
"Physical (MAC) address",
|
||||
"Interface name",
|
||||
"Is default route"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseLocalIpCommandOptions(FFLocalIpOptions* options, const char* key, co
|
||||
void ffDestroyLocalIpOptions(FFLocalIpOptions* options);
|
||||
void ffParseLocalIpJsonObject(FFLocalIpOptions* options, yyjson_val* module);
|
||||
void ffGenerateLocalIpJson(FFLocalIpOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintLocalIpHelpFormat(void);
|
||||
|
||||
@@ -107,7 +107,7 @@ void ffPrintMedia(FFMediaOptions* options)
|
||||
|
||||
void ffInitMediaOptions(FFMediaOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MEDIA_MODULE_NAME, ffParseMediaCommandOptions, ffParseMediaJsonObject, ffPrintMedia, ffGenerateMediaJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MEDIA_MODULE_NAME, ffParseMediaCommandOptions, ffParseMediaJsonObject, ffPrintMedia, ffGenerateMediaJson, ffPrintMediaHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -159,3 +159,14 @@ void ffGenerateMediaJson(FF_MAYBE_UNUSED FFMediaOptions* options, yyjson_mut_doc
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "album", &media->album);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "status", &media->status);
|
||||
}
|
||||
|
||||
void ffPrintMediaHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_MEDIA_MODULE_NAME, "{3} - {1} ({5})", FF_MEDIA_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Pretty media name",
|
||||
"Media name",
|
||||
"Artist name",
|
||||
"Album name",
|
||||
"Status",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseMediaCommandOptions(FFMediaOptions* options, const char* key, const
|
||||
void ffDestroyMediaOptions(FFMediaOptions* options);
|
||||
void ffParseMediaJsonObject(FFMediaOptions* options, yyjson_val* module);
|
||||
void ffGenerateMediaJson(FFMediaOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintMediaHelpFormat(void);
|
||||
|
||||
@@ -68,7 +68,7 @@ void ffPrintMemory(FFMemoryOptions* options)
|
||||
|
||||
void ffInitMemoryOptions(FFMemoryOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MEMORY_MODULE_NAME, ffParseMemoryCommandOptions, ffParseMemoryJsonObject, ffPrintMemory, ffGenerateMemoryJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MEMORY_MODULE_NAME, ffParseMemoryCommandOptions, ffParseMemoryJsonObject, ffPrintMemory, ffGenerateMemoryJson, ffPrintMemoryHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -119,3 +119,12 @@ void ffGenerateMemoryJson(FF_MAYBE_UNUSED FFMemoryOptions* options, yyjson_mut_d
|
||||
yyjson_mut_obj_add_uint(doc, obj, "total", storage.bytesTotal);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "used", storage.bytesUsed);
|
||||
}
|
||||
|
||||
void ffPrintMemoryHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_MEMORY_MODULE_NAME, "{1} / {2} ({3})", FF_MEMORY_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Used size",
|
||||
"Total size",
|
||||
"Percentage used"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseMemoryCommandOptions(FFMemoryOptions* options, const char* key, cons
|
||||
void ffDestroyMemoryOptions(FFMemoryOptions* options);
|
||||
void ffParseMemoryJsonObject(FFMemoryOptions* options, yyjson_val* module);
|
||||
void ffGenerateMemoryJson(FFMemoryOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintMemoryHelpFormat(void);
|
||||
|
||||
@@ -77,7 +77,7 @@ void ffPrintMonitor(FFMonitorOptions* options)
|
||||
|
||||
void ffInitMonitorOptions(FFMonitorOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MONITOR_MODULE_NAME, ffParseMonitorCommandOptions, ffParseMonitorJsonObject, ffPrintMonitor, ffGenerateMonitorJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MONITOR_MODULE_NAME, ffParseMonitorCommandOptions, ffParseMonitorJsonObject, ffPrintMonitor, ffGenerateMonitorJson, ffPrintMonitorHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -147,3 +147,16 @@ void ffGenerateMonitorJson(FF_MAYBE_UNUSED FFMonitorOptions* options, yyjson_mut
|
||||
ffStrbufDestroy(&item->name);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintMonitorHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_MONITOR_MODULE_NAME, "{2}x{3} px - {4}x{5} mm ({6} inches, {7} ppi)", FF_MONITOR_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Display name",
|
||||
"Display native resolution width in pixels",
|
||||
"Display native resolution height in pixels",
|
||||
"Display physical width in millimeters",
|
||||
"Display physical height in millimeters",
|
||||
"Display physical diagonal length in inches",
|
||||
"Display physical pixels per inch (PPI)"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseMonitorCommandOptions(FFMonitorOptions* options, const char* key, co
|
||||
void ffDestroyMonitorOptions(FFMonitorOptions* options);
|
||||
void ffParseMonitorJsonObject(FFMonitorOptions* options, yyjson_val* module);
|
||||
void ffGenerateMonitorJson(FFMonitorOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintMonitorHelpFormat(void);
|
||||
|
||||
@@ -101,7 +101,7 @@ void ffPrintNetIO(FFNetIOOptions* options)
|
||||
|
||||
void ffInitNetIOOptions(FFNetIOOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_NETIO_MODULE_NAME, ffParseNetIOCommandOptions, ffParseNetIOJsonObject, ffPrintNetIO, ffGenerateNetIOJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_NETIO_MODULE_NAME, ffParseNetIOCommandOptions, ffParseNetIOJsonObject, ffPrintNetIO, ffGenerateNetIOJson, ffPrintNetIOHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufInit(&options->namePrefix);
|
||||
@@ -197,3 +197,13 @@ void ffGenerateNetIOJson(FFNetIOOptions* options, yyjson_mut_doc* doc, yyjson_mu
|
||||
ffStrbufDestroy(&inf->name);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintNetIOHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_NETIO_MODULE_NAME, "{1} (IN) - {2} (OUT){4}", FF_NETIO_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Size of data received per second (formatted)",
|
||||
"Size of data sent per second (formatted)",
|
||||
"Interface name",
|
||||
"Is default route"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,3 +12,4 @@ bool ffParseNetIOCommandOptions(FFNetIOOptions* options, const char* key, const
|
||||
void ffDestroyNetIOOptions(FFNetIOOptions* options);
|
||||
void ffParseNetIOJsonObject(FFNetIOOptions* options, yyjson_val* module);
|
||||
void ffGenerateNetIOJson(FFNetIOOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintNetIOHelpFormat(void);
|
||||
|
||||
@@ -41,7 +41,7 @@ void ffPrintOpenCL(FFOpenCLOptions* options)
|
||||
|
||||
void ffInitOpenCLOptions(FFOpenCLOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OPENCL_MODULE_NAME, ffParseOpenCLCommandOptions, ffParseOpenCLJsonObject, ffPrintOpenCL, ffGenerateOpenCLJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OPENCL_MODULE_NAME, ffParseOpenCLCommandOptions, ffParseOpenCLJsonObject, ffPrintOpenCL, ffGenerateOpenCLJson, ffPrintOpenCLHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -102,3 +102,12 @@ void ffGenerateOpenCLJson(FF_MAYBE_UNUSED FFOpenCLOptions* options, yyjson_mut_d
|
||||
ffStrbufDestroy(&opencl.device);
|
||||
ffStrbufDestroy(&opencl.vendor);
|
||||
}
|
||||
|
||||
void ffPrintOpenCLHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_OPENCL_MODULE_NAME, "{1}", FF_OPENCL_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"version",
|
||||
"device",
|
||||
"vendor"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseOpenCLCommandOptions(FFOpenCLOptions* options, const char* key, cons
|
||||
void ffDestroyOpenCLOptions(FFOpenCLOptions* options);
|
||||
void ffParseOpenCLJsonObject(FFOpenCLOptions* options, yyjson_val* module);
|
||||
void ffGenerateOpenCLJson(FFOpenCLOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintOpenCLHelpFormat(void);
|
||||
|
||||
@@ -44,7 +44,7 @@ void ffPrintOpenGL(FFOpenGLOptions* options)
|
||||
|
||||
void ffInitOpenGLOptions(FFOpenGLOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OPENGL_MODULE_NAME, ffParseOpenGLCommandOptions, ffParseOpenGLJsonObject, ffPrintOpenGL, ffGenerateOpenGLJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OPENGL_MODULE_NAME, ffParseOpenGLCommandOptions, ffParseOpenGLJsonObject, ffPrintOpenGL, ffGenerateOpenGLJson, ffPrintOpenGLHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
@@ -143,3 +143,13 @@ void ffGenerateOpenGLJson(FF_MAYBE_UNUSED FFOpenGLOptions* options, yyjson_mut_d
|
||||
ffStrbufDestroy(&result.vendor);
|
||||
ffStrbufDestroy(&result.slv);
|
||||
}
|
||||
|
||||
void ffPrintOpenGLHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_OPENGL_MODULE_NAME, "{1}", FF_OPENGL_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"version",
|
||||
"renderer",
|
||||
"vendor",
|
||||
"shading language version"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseOpenGLCommandOptions(FFOpenGLOptions* options, const char* key, cons
|
||||
void ffDestroyOpenGLOptions(FFOpenGLOptions* options);
|
||||
void ffParseOpenGLJsonObject(FFOpenGLOptions* options, yyjson_val* module);
|
||||
void ffGenerateOpenGLJson(FFOpenGLOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintOpenGLHelpFormat(void);
|
||||
|
||||
+19
-1
@@ -138,7 +138,7 @@ void ffPrintOS(FFOSOptions* options)
|
||||
|
||||
void ffInitOSOptions(FFOSOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OS_MODULE_NAME, ffParseOSCommandOptions, ffParseOSJsonObject, ffPrintOS, ffGenerateOSJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_OS_MODULE_NAME, ffParseOSCommandOptions, ffParseOSJsonObject, ffPrintOS, ffGenerateOSJson, ffPrintOSHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -196,3 +196,21 @@ void ffGenerateOSJson(FF_MAYBE_UNUSED FFOSOptions* options, yyjson_mut_doc* doc,
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &os->version);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "versionID", &os->versionID);
|
||||
}
|
||||
|
||||
void ffPrintOSHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_OS_MODULE_NAME, "{3} {10} {12}", FF_OS_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Name of the kernel (Linux, WIN32_NT, Darwin, FreeBSD)",
|
||||
"Name of the OS",
|
||||
"Pretty name of the OS",
|
||||
"ID of the OS",
|
||||
"ID like of the OS",
|
||||
"Variant of the OS",
|
||||
"Variant ID of the OS",
|
||||
"Version of the OS",
|
||||
"Version ID of the OS",
|
||||
"Version codename of the OS",
|
||||
"Build ID of the OS",
|
||||
"Architecture of the OS"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseOSCommandOptions(FFOSOptions* options, const char* key, const char*
|
||||
void ffDestroyOSOptions(FFOSOptions* options);
|
||||
void ffParseOSJsonObject(FFOSOptions* options, yyjson_val* module);
|
||||
void ffGenerateOSJson(FFOSOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintOSHelpFormat(void);
|
||||
|
||||
@@ -102,7 +102,7 @@ void ffPrintPackages(FFPackagesOptions* options)
|
||||
|
||||
void ffInitPackagesOptions(FFPackagesOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PACKAGES_MODULE_NAME, ffParsePackagesCommandOptions, ffParsePackagesJsonObject, ffPrintPackages, ffGeneratePackagesJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PACKAGES_MODULE_NAME, ffParsePackagesCommandOptions, ffParsePackagesJsonObject, ffPrintPackages, ffGeneratePackagesJson, ffPrintPackagesHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -180,3 +180,33 @@ void ffGeneratePackagesJson(FF_MAYBE_UNUSED FFPackagesOptions* options, yyjson_m
|
||||
FF_APPEND_PACKAGE_COUNT(xbps)
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "pacmanBranch", &counts.pacmanBranch);
|
||||
}
|
||||
|
||||
void ffPrintPackagesHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_PACKAGES_MODULE_NAME, "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (port), {20} (scoop), {21} (choco), {22} (pkgtool), {23} (paludis), {24} (winget)", FF_PACKAGES_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Number of all packages",
|
||||
"Number of pacman packages",
|
||||
"Pacman branch on manjaro",
|
||||
"Number of dpkg packages",
|
||||
"Number of rpm packages",
|
||||
"Number of emerge packages",
|
||||
"Number of eopkg packages",
|
||||
"Number of xbps packages",
|
||||
"Number of nix-system packages",
|
||||
"Number of nix-user packages",
|
||||
"Number of nix-default packages",
|
||||
"Number of apk packages",
|
||||
"Number of pkg packages",
|
||||
"Number of flatpak-system packages",
|
||||
"Number of flatpak-user packages",
|
||||
"Number of snap packages",
|
||||
"Number of brew packages",
|
||||
"Number of brew-cask packages",
|
||||
"Number of macports packages",
|
||||
"Number of scoop packages",
|
||||
"Number of choco packages",
|
||||
"Number of pkgtool packages",
|
||||
"Number of paludis packages"
|
||||
"Number of winget packages"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParsePackagesCommandOptions(FFPackagesOptions* options, const char* key,
|
||||
void ffDestroyPackagesOptions(FFPackagesOptions* options);
|
||||
void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module);
|
||||
void ffGeneratePackagesJson(FFPackagesOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintPackagesHelpFormat(void);
|
||||
|
||||
@@ -75,7 +75,7 @@ void ffPrintPlayer(FFPlayerOptions* options)
|
||||
|
||||
void ffInitPlayerOptions(FFPlayerOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PLAYER_MODULE_NAME, ffParsePlayerCommandOptions, ffParsePlayerJsonObject, ffPrintPlayer, ffGeneratePlayerJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PLAYER_MODULE_NAME, ffParsePlayerCommandOptions, ffParsePlayerJsonObject, ffPrintPlayer, ffGeneratePlayerJson, ffPrintPlayerHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -126,3 +126,13 @@ void ffGeneratePlayerJson(FF_MAYBE_UNUSED FFMediaOptions* options, yyjson_mut_do
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "playerId", &media->playerId);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "url", &media->url);
|
||||
}
|
||||
|
||||
void ffPrintPlayerHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_PLAYER_MODULE_NAME, "{1}", FF_PLAYER_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Pretty player name",
|
||||
"Player name",
|
||||
"Player Identifier",
|
||||
"URL name"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,3 +11,4 @@ bool ffParsePlayerCommandOptions(FFPlayerOptions* options, const char* key, cons
|
||||
void ffDestroyPlayerOptions(FFPlayerOptions* options);
|
||||
void ffParsePlayerJsonObject(FFPlayerOptions* options, yyjson_val* module);
|
||||
void ffGeneratePlayerJson(FFMediaOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintPlayerHelpFormat(void);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_POWERADAPTER_DISPLAY_NAME "Power Adapter"
|
||||
#define FF_POWERADAPTER_MODULE_ARGS 5
|
||||
#define FF_POWERADAPTER_NUM_FORMAT_ARGS 5
|
||||
|
||||
void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormat(FF_POWERADAPTER_DISPLAY_NAME, i, &options->moduleArgs, FF_POWERADAPTER_MODULE_ARGS, (FFformatarg[]){
|
||||
ffPrintFormat(FF_POWERADAPTER_DISPLAY_NAME, i, &options->moduleArgs, FF_POWERADAPTER_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_INT, &result->watts},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer},
|
||||
@@ -62,7 +62,7 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
||||
|
||||
void ffInitPowerAdapterOptions(FFPowerAdapterOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_POWERADAPTER_MODULE_NAME, ffParsePowerAdapterCommandOptions, ffParsePowerAdapterJsonObject, ffPrintPowerAdapter, ffGeneratePowerAdapterJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_POWERADAPTER_MODULE_NAME, ffParsePowerAdapterCommandOptions, ffParsePowerAdapterJsonObject, ffPrintPowerAdapter, ffGeneratePowerAdapterJson, ffPrintPowerAdapterHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -126,3 +126,14 @@ void ffGeneratePowerAdapterJson(FF_MAYBE_UNUSED FFPowerAdapterOptions* options,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintPowerAdapterHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_POWERADAPTER_MODULE_NAME, "{1}W", FF_POWERADAPTER_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"PowerAdapter watts",
|
||||
"PowerAdapter name",
|
||||
"PowerAdapter manufacturer",
|
||||
"PowerAdapter model",
|
||||
"PowerAdapter description"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParsePowerAdapterCommandOptions(FFPowerAdapterOptions* options, const cha
|
||||
void ffDestroyPowerAdapterOptions(FFPowerAdapterOptions* options);
|
||||
void ffParsePowerAdapterJsonObject(FFPowerAdapterOptions* options, yyjson_val* module);
|
||||
void ffGeneratePowerAdapterJson(FFPowerAdapterOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintPowerAdapterHelpFormat(void);
|
||||
|
||||
@@ -33,7 +33,7 @@ void ffPrintProcesses(FFProcessesOptions* options)
|
||||
|
||||
void ffInitProcessesOptions(FFProcessesOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PROCESSES_MODULE_NAME, ffParseProcessesCommandOptions, ffParseProcessesJsonObject, ffPrintProcesses, ffGenerateProcessesJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PROCESSES_MODULE_NAME, ffParseProcessesCommandOptions, ffParseProcessesJsonObject, ffPrintProcesses, ffGenerateProcessesJson, ffPrintProcessesHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -82,3 +82,10 @@ void ffGenerateProcessesJson(FF_MAYBE_UNUSED FFProcessesOptions* options, yyjson
|
||||
|
||||
yyjson_mut_obj_add_uint(doc, module, "result", result);
|
||||
}
|
||||
|
||||
void ffPrintProcessesHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_PROCESSES_MODULE_NAME, "{1}", FF_PROCESSES_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Count"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseProcessesCommandOptions(FFProcessesOptions* options, const char* key
|
||||
void ffDestroyProcessesOptions(FFProcessesOptions* options);
|
||||
void ffParseProcessesJsonObject(FFProcessesOptions* options, yyjson_val* module);
|
||||
void ffGenerateProcessesJson(FFProcessesOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintProcessesHelpFormat(void);
|
||||
|
||||
@@ -42,7 +42,7 @@ void ffPrintPublicIp(FFPublicIpOptions* options)
|
||||
|
||||
void ffInitPublicIpOptions(FFPublicIpOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PUBLICIP_MODULE_NAME, ffParsePublicIpCommandOptions, ffParsePublicIpJsonObject, ffPrintPublicIp, ffGeneratePublicIpJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_PUBLICIP_MODULE_NAME, ffParsePublicIpCommandOptions, ffParsePublicIpJsonObject, ffPrintPublicIp, ffGeneratePublicIpJson, ffPrintPublicIpHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufInit(&options->url);
|
||||
@@ -127,3 +127,11 @@ void ffGeneratePublicIpJson(FFPublicIpOptions* options, yyjson_mut_doc* doc, yyj
|
||||
ffStrbufDestroy(&result.ip);
|
||||
ffStrbufDestroy(&result.location);
|
||||
}
|
||||
|
||||
void ffPrintPublicIpHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_PUBLICIP_MODULE_NAME, "{1} ({2})", FF_PUBLICIP_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Public IP address",
|
||||
"Location"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,3 +12,4 @@ bool ffParsePublicIpCommandOptions(FFPublicIpOptions* options, const char* key,
|
||||
void ffDestroyPublicIpOptions(FFPublicIpOptions* options);
|
||||
void ffParsePublicIpJsonObject(FFPublicIpOptions* options, yyjson_val* module);
|
||||
void ffGeneratePublicIpJson(FFPublicIpOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintPublicIpHelpFormat(void);
|
||||
|
||||
@@ -77,7 +77,7 @@ void ffPrintSeparator(FFSeparatorOptions* options)
|
||||
|
||||
void ffInitSeparatorOptions(FFSeparatorOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_SEPARATOR_MODULE_NAME, ffParseSeparatorCommandOptions, ffParseSeparatorJsonObject, ffPrintSeparator, NULL);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_SEPARATOR_MODULE_NAME, ffParseSeparatorCommandOptions, ffParseSeparatorJsonObject, ffPrintSeparator, NULL, NULL);
|
||||
ffStrbufInit(&options->string);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ void ffPrintShell(FFShellOptions* options)
|
||||
|
||||
void ffInitShellOptions(FFShellOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_SHELL_MODULE_NAME, ffParseShellCommandOptions, ffParseShellJsonObject, ffPrintShell, ffGenerateShellJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_SHELL_MODULE_NAME, ffParseShellCommandOptions, ffParseShellJsonObject, ffPrintShell, ffGenerateShellJson, ffPrintShellHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -97,3 +97,15 @@ void ffGenerateShellJson(FF_MAYBE_UNUSED FFShellOptions* options, yyjson_mut_doc
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "processName", &result->shellProcessName);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &result->shellVersion);
|
||||
}
|
||||
|
||||
void ffPrintShellHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_SHELL_MODULE_NAME, "{3} {4}", FF_SHELL_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Shell process name",
|
||||
"Shell path with exe name",
|
||||
"Shell exe name",
|
||||
"Shell version",
|
||||
"Shell pid",
|
||||
"Shell pretty name"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseShellCommandOptions(FFShellOptions* options, const char* key, const
|
||||
void ffDestroyShellOptions(FFShellOptions* options);
|
||||
void ffParseShellJsonObject(FFShellOptions* options, yyjson_val* module);
|
||||
void ffGenerateShellJson(FFShellOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintShellHelpFormat(void);
|
||||
|
||||
@@ -85,7 +85,7 @@ void ffPrintSound(FFSoundOptions* options)
|
||||
|
||||
void ffInitSoundOptions(FFSoundOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_SOUND_MODULE_NAME, ffParseSoundCommandOptions, ffParseSoundJsonObject, ffPrintSound, ffGenerateSoundJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_SOUND_MODULE_NAME, ffParseSoundCommandOptions, ffParseSoundJsonObject, ffPrintSound, ffGenerateSoundJson, ffPrintSoundHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->soundType = FF_SOUND_TYPE_MAIN;
|
||||
@@ -189,3 +189,13 @@ void ffGenerateSoundJson(FF_MAYBE_UNUSED FFSoundOptions* options, yyjson_mut_doc
|
||||
ffStrbufDestroy(&device->name);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintSoundHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_SOUND_MODULE_NAME, "{2} ({3}%)", FF_SOUND_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Is main sound device",
|
||||
"Device name",
|
||||
"Volume",
|
||||
"Identifier"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseSoundCommandOptions(FFSoundOptions* options, const char* key, const
|
||||
void ffDestroySoundOptions(FFSoundOptions* options);
|
||||
void ffParseSoundJsonObject(FFSoundOptions* options, yyjson_val* module);
|
||||
void ffGenerateSoundJson(FFSoundOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintSoundHelpFormat(void);
|
||||
|
||||
+10
-1
@@ -75,7 +75,7 @@ void ffPrintSwap(FFSwapOptions* options)
|
||||
|
||||
void ffInitSwapOptions(FFSwapOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_SWAP_MODULE_NAME, ffParseSwapCommandOptions, ffParseSwapJsonObject, ffPrintSwap, ffGenerateSwapJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_SWAP_MODULE_NAME, ffParseSwapCommandOptions, ffParseSwapJsonObject, ffPrintSwap, ffGenerateSwapJson, ffPrintSwapHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -126,3 +126,12 @@ void ffGenerateSwapJson(FF_MAYBE_UNUSED FFSwapOptions* options, yyjson_mut_doc*
|
||||
yyjson_mut_obj_add_uint(doc, obj, "total", storage.bytesTotal);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "used", storage.bytesUsed);
|
||||
}
|
||||
|
||||
void ffPrintSwapHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_SWAP_MODULE_NAME, "{1} / {2} ({3})", FF_SWAP_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Used size",
|
||||
"Total size",
|
||||
"Percentage used"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseSwapCommandOptions(FFSwapOptions* options, const char* key, const ch
|
||||
void ffDestroySwapOptions(FFSwapOptions* options);
|
||||
void ffParseSwapJsonObject(FFSwapOptions* options, yyjson_val* module);
|
||||
void ffGenerateSwapJson(FFSwapOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintSwapHelpFormat(void);
|
||||
|
||||
@@ -42,7 +42,7 @@ void ffPrintTerminal(FFTerminalOptions* options)
|
||||
|
||||
void ffInitTerminalOptions(FFTerminalOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_TERMINAL_MODULE_NAME, ffParseTerminalCommandOptions, ffParseTerminalJsonObject, ffPrintTerminal, ffGenerateTerminalJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_TERMINAL_MODULE_NAME, ffParseTerminalCommandOptions, ffParseTerminalJsonObject, ffPrintTerminal, ffGenerateTerminalJson, ffPrintTerminalHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -96,3 +96,15 @@ void ffGenerateTerminalJson(FF_MAYBE_UNUSED FFTerminalOptions* options, yyjson_m
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "prettyName", &result->terminalPrettyName);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &result->terminalVersion);
|
||||
}
|
||||
|
||||
void ffPrintTerminalHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_TERMINAL_MODULE_NAME, "{5} {6}", FF_TERMINAL_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Terminal process name",
|
||||
"Terminal path with exe name",
|
||||
"Terminal exe name",
|
||||
"Terminal pid",
|
||||
"Terminal pretty name",
|
||||
"Terminal version"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseTerminalCommandOptions(FFTerminalOptions* options, const char* key,
|
||||
void ffDestroyTerminalOptions(FFTerminalOptions* options);
|
||||
void ffParseTerminalJsonObject(FFTerminalOptions* options, yyjson_val* module);
|
||||
void ffGenerateTerminalJson(FFTerminalOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintTerminalHelpFormat(void);
|
||||
|
||||
@@ -49,7 +49,7 @@ void ffPrintTerminalFont(FFTerminalFontOptions* options)
|
||||
|
||||
void ffInitTerminalFontOptions(FFTerminalFontOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_TERMINALFONT_MODULE_NAME, ffParseTerminalFontCommandOptions, ffParseTerminalFontJsonObject, ffPrintTerminalFont, ffGenerateTerminalFontJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_TERMINALFONT_MODULE_NAME, ffParseTerminalFontCommandOptions, ffParseTerminalFontJsonObject, ffPrintTerminalFont, ffGenerateTerminalFontJson, ffPrintTerminalFontHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -124,3 +124,13 @@ void ffGenerateTerminalFontJson(FF_MAYBE_UNUSED FFTerminalOptions* options, yyjs
|
||||
ffFontDestroy(&result.font);
|
||||
ffFontDestroy(&result.fallback);
|
||||
}
|
||||
|
||||
void ffPrintTerminalFontHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_TERMINALFONT_MODULE_NAME, "{1}", FF_TERMINALFONT_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Terminal font combined",
|
||||
"Terminal font name",
|
||||
"Terminal font size",
|
||||
"Terminal font styles"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseTerminalFontCommandOptions(FFTerminalFontOptions* options, const cha
|
||||
void ffDestroyTerminalFontOptions(FFTerminalFontOptions* options);
|
||||
void ffParseTerminalFontJsonObject(FFTerminalFontOptions* options, yyjson_val* module);
|
||||
void ffGenerateTerminalFontJson(FFTerminalOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintTerminalFontHelpFormat(void);
|
||||
|
||||
@@ -41,7 +41,7 @@ void ffPrintTerminalSize(FFTerminalSizeOptions* options)
|
||||
|
||||
void ffInitTerminalSizeOptions(FFTerminalSizeOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_TERMINALSIZE_MODULE_NAME, ffParseTerminalSizeCommandOptions, ffParseTerminalSizeJsonObject, ffPrintTerminalSize, ffGenerateTerminalSizeJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_TERMINALSIZE_MODULE_NAME, ffParseTerminalSizeCommandOptions, ffParseTerminalSizeJsonObject, ffPrintTerminalSize, ffGenerateTerminalSizeJson, ffPrintTerminalSizeHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -93,3 +93,13 @@ void ffGenerateTerminalSizeJson(FF_MAYBE_UNUSED FFTerminalOptions* options, yyjs
|
||||
yyjson_mut_obj_add_uint(doc, obj, "width", result.width);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "height", result.height);
|
||||
}
|
||||
|
||||
void ffPrintTerminalSizeHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_TERMINALSIZE_MODULE_NAME, "{1} columns x {2} rows ({3}px x {4}px)", FF_TERMINALSIZE_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Terminal rows",
|
||||
"Terminal columns",
|
||||
"Terminal width (in pixels)",
|
||||
"Terminal height (in pixels)"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseTerminalSizeCommandOptions(FFTerminalSizeOptions* options, const cha
|
||||
void ffDestroyTerminalSizeOptions(FFTerminalSizeOptions* options);
|
||||
void ffParseTerminalSizeJsonObject(FFTerminalSizeOptions* options, yyjson_val* module);
|
||||
void ffGenerateTerminalSizeJson(FFTerminalOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintTerminalSizeHelpFormat(void);
|
||||
|
||||
@@ -32,7 +32,7 @@ void ffPrintTheme(FFThemeOptions* options)
|
||||
|
||||
void ffInitThemeOptions(FFThemeOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_THEME_MODULE_NAME, ffParseThemeCommandOptions, ffParseThemeJsonObject, ffPrintTheme, ffGenerateThemeJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_THEME_MODULE_NAME, ffParseThemeCommandOptions, ffParseThemeJsonObject, ffPrintTheme, ffGenerateThemeJson, ffPrintThemeHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -81,3 +81,10 @@ void ffGenerateThemeJson(FF_MAYBE_UNUSED FFThemeOptions* options, yyjson_mut_doc
|
||||
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "result", &theme);
|
||||
}
|
||||
|
||||
void ffPrintThemeHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_THEME_MODULE_NAME, "{1}", FF_THEME_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Combined themes"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseThemeCommandOptions(FFThemeOptions* options, const char* key, const
|
||||
void ffDestroyThemeOptions(FFThemeOptions* options);
|
||||
void ffParseThemeJsonObject(FFThemeOptions* options, yyjson_val* module);
|
||||
void ffGenerateThemeJson(FFThemeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintThemeHelpFormat(void);
|
||||
|
||||
@@ -71,7 +71,7 @@ void ffPrintTitle(FFTitleOptions* options)
|
||||
|
||||
void ffInitTitleOptions(FFTitleOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_TITLE_MODULE_NAME, ffParseTitleCommandOptions, ffParseTitleJsonObject, ffPrintTitle, ffGenerateTitleJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_TITLE_MODULE_NAME, ffParseTitleCommandOptions, ffParseTitleJsonObject, ffPrintTitle, ffGenerateTitleJson, ffPrintTitleHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
||||
|
||||
@@ -172,3 +172,17 @@ void ffGenerateTitleJson(FF_MAYBE_UNUSED FFTitleOptions* options, yyjson_mut_doc
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "exePath", &instance.state.platform.exePath);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "userShell", &instance.state.platform.userShell);
|
||||
}
|
||||
|
||||
void ffPrintTitleHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_TITLE_MODULE_NAME, "{6}{7}{8}", FF_TITLE_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"User name",
|
||||
"Host name",
|
||||
"Home directory",
|
||||
"Executable path of current process",
|
||||
"User's default shell",
|
||||
"User name (colored)",
|
||||
"@ symbol (colored)",
|
||||
"Host name (colored)"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseTitleCommandOptions(FFTitleOptions* options, const char* key, const
|
||||
void ffDestroyTitleOptions(FFTitleOptions* options);
|
||||
void ffParseTitleJsonObject(FFTitleOptions* options, yyjson_val* module);
|
||||
void ffGenerateTitleJson(FFTitleOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintTitleHelpFormat(void);
|
||||
|
||||
@@ -91,7 +91,7 @@ void ffPrintUptime(FFUptimeOptions* options)
|
||||
|
||||
void ffInitUptimeOptions(FFUptimeOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_UPTIME_MODULE_NAME, ffParseUptimeCommandOptions, ffParseUptimeJsonObject, ffPrintUptime, ffGenerateUptimeJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_UPTIME_MODULE_NAME, ffParseUptimeCommandOptions, ffParseUptimeJsonObject, ffPrintUptime, ffGenerateUptimeJson, ffPrintUptimeHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -142,3 +142,13 @@ void ffGenerateUptimeJson(FF_MAYBE_UNUSED FFUptimeOptions* options, yyjson_mut_d
|
||||
yyjson_mut_obj_add_uint(doc, obj, "uptime", result.uptime);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "bootTime", result.bootTime);
|
||||
}
|
||||
|
||||
void ffPrintUptimeHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_UPTIME_MODULE_NAME, "{1} days {2} hours {3} mins", FF_UPTIME_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Days",
|
||||
"Hours",
|
||||
"Minutes",
|
||||
"Seconds"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseUptimeCommandOptions(FFUptimeOptions* options, const char* key, cons
|
||||
void ffDestroyUptimeOptions(FFUptimeOptions* options);
|
||||
void ffParseUptimeJsonObject(FFUptimeOptions* options, yyjson_val* module);
|
||||
void ffGenerateUptimeJson(FFUptimeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintUptimeHelpFormat(void);
|
||||
|
||||
@@ -93,7 +93,7 @@ void ffPrintUsers(FFUsersOptions* options)
|
||||
|
||||
void ffInitUsersOptions(FFUsersOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_USERS_MODULE_NAME, ffParseUsersCommandOptions, ffParseUsersJsonObject, ffPrintUsers, ffGenerateUsersJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_USERS_MODULE_NAME, ffParseUsersCommandOptions, ffParseUsersJsonObject, ffPrintUsers, ffGenerateUsersJson, ffPrintUsersHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
|
||||
options->compact = false;
|
||||
@@ -175,3 +175,14 @@ exit:
|
||||
ffStrbufDestroy(&user->name);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintUsersHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_USERS_MODULE_NAME, "{1}@{2} - login time {5}", FF_USERS_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"User name",
|
||||
"Host name",
|
||||
"TTY name",
|
||||
"Client IP",
|
||||
"Login Time"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseUsersCommandOptions(FFUsersOptions* options, const char* key, const
|
||||
void ffDestroyUsersOptions(FFUsersOptions* options);
|
||||
void ffParseUsersJsonObject(FFUsersOptions* options, yyjson_val* module);
|
||||
void ffGenerateUsersJson(FFUsersOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintUsersHelpFormat(void);
|
||||
|
||||
@@ -47,7 +47,7 @@ void ffPrintVersion(FFVersionOptions* options)
|
||||
|
||||
void ffInitVersionOptions(FFVersionOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_VERSION_MODULE_NAME, ffParseVersionCommandOptions, ffParseVersionJsonObject, ffPrintVersion, ffGenerateVersionJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_VERSION_MODULE_NAME, ffParseVersionCommandOptions, ffParseVersionJsonObject, ffPrintVersion, ffGenerateVersionJson, ffPrintVersionHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -114,3 +114,18 @@ void ffGenerateVersionJson(FF_MAYBE_UNUSED FFVersionOptions* options, yyjson_mut
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "libc", &buf);
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintVersionHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_VERSION_MODULE_NAME, "{1} {2}{3} ({5})", FF_VERSION_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"Project name",
|
||||
"Version",
|
||||
"Version tweak",
|
||||
"Build type (debug or release)",
|
||||
"Architecture",
|
||||
"CMake build type (Debug, Release, RelWithDebInfo, MinSizeRel)",
|
||||
"Date time when compiling",
|
||||
"Compiler used",
|
||||
"Libc used"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParseVersionCommandOptions(FFVersionOptions* options, const char* key, co
|
||||
void ffDestroyVersionOptions(FFVersionOptions* options);
|
||||
void ffParseVersionJsonObject(FFVersionOptions* options, yyjson_val* module);
|
||||
void ffGenerateVersionJson(FFVersionOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintVersionHelpFormat(void);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user