mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c145ce49a5 | |||
| 8c4fb5d6d4 | |||
| eae0fee032 | |||
| 4472a13f41 | |||
| 5b001d6bd6 | |||
| 1b52029fce | |||
| 2176ea2937 | |||
| ac2266c72f | |||
| 0dc40a2632 | |||
| ca975f8e81 | |||
| c4c6fe6668 | |||
| 0a00f5721e | |||
| 69f180beea | |||
| 0e9cdf75b5 | |||
| 7d7e219c0a | |||
| 4937ccfa81 | |||
| d0d29c163b | |||
| 901e0eb177 | |||
| 87446e6eef | |||
| bfaa73a2c7 | |||
| 373e288d03 | |||
| 82170ceab0 | |||
| 009a7888b5 | |||
| ab1a11c9fa | |||
| 68746275f8 | |||
| 491cfb94b6 | |||
| 79c8919431 | |||
| e98afa8315 | |||
| 86783c033b | |||
| f01944de41 | |||
| ebfdeef25c | |||
| 9a36d63d18 | |||
| e45ff546ed | |||
| 2700390371 | |||
| 5c01685d69 | |||
| d897472572 | |||
| 8410a66277 | |||
| 856d229b36 | |||
| b33692aa7d | |||
| e90c5cb241 | |||
| 03cd283755 |
@@ -452,7 +452,7 @@ jobs:
|
|||||||
version: '7.5'
|
version: '7.5'
|
||||||
run: |
|
run: |
|
||||||
uname -a
|
uname -a
|
||||||
sudo pkg_add -r cmake git pkgconf wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 xfconf imagemagick chafa pulseaudio py3-requests
|
sudo pkg_add -r cmake git pkgconf wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 xfconf imagemagick chafa pulseaudio hwdata py3-requests
|
||||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=ON .
|
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=ON .
|
||||||
cmake --build . --target package --verbose -j4
|
cmake --build . --target package --verbose -j4
|
||||||
./fastfetch --list-features
|
./fastfetch --list-features
|
||||||
|
|||||||
@@ -1,3 +1,40 @@
|
|||||||
|
# 2.32.1
|
||||||
|
|
||||||
|
A hotfix for OpenBSD. No changes to other platforms.
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fix package count detection on OpenBSD (Packages, OpenBSD)
|
||||||
|
|
||||||
|
# 2.32.0
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fix `pci.ids` file location on OpenBSD (GPU, OpenBSD)
|
||||||
|
* It's normally unused because enumerating PCI devices on OpenBSD requires root privileges
|
||||||
|
* Fix bssid formatting (Wifi, Linux)
|
||||||
|
* Fix Linux Lite distro detection (#1434, OS, Linux)
|
||||||
|
* Suppress XE driver warnings from Mesa (#1435, OpenGL, Linux)
|
||||||
|
* Fix format parameter name (#1443, Version)
|
||||||
|
* Don't report useless information when Wifi is disabled (Wifi, FreeBSD)
|
||||||
|
* Currently there are issues when the SSID contains whitespaces. More fixes are expected in the future.
|
||||||
|
* Always use physical size reported by X11 server to avoid inconsistent results (#1444, Display, Linux)
|
||||||
|
|
||||||
|
Features:
|
||||||
|
* Randomly select one if the logo source expands to multiple files (#1426, Logo)
|
||||||
|
* Report mac product name when running Linux in MacBook (Host, Linux / FreeBSD)
|
||||||
|
* Use screen size reported in DTD if make sense (Display)
|
||||||
|
* Detect Virtualized Apple Silicon CPUs (CPU, Linux)
|
||||||
|
* Add detection support for fvwm and ctwm (WM, OpenBSD / NetBSD)
|
||||||
|
* Add Armbian-unofficial detection (OS, Linux)
|
||||||
|
* Prefer surfaceless display when connect EGL (OpenGL)
|
||||||
|
* Improve accuracy of WM detection on FreeBSD (WM, FreeBSD)
|
||||||
|
* Add ratpoison window manager (WM, Linux)
|
||||||
|
|
||||||
|
Logo:
|
||||||
|
* Update Linux Lite
|
||||||
|
* Add Serpent OS
|
||||||
|
* Add Ultramarine Small
|
||||||
|
* Update Debian
|
||||||
|
|
||||||
# 2.31.0
|
# 2.31.0
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|||||||
+5
-1
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||||
|
|
||||||
project(fastfetch
|
project(fastfetch
|
||||||
VERSION 2.31.0
|
VERSION 2.32.1
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
DESCRIPTION "Fast neofetch-like system information tool"
|
DESCRIPTION "Fast neofetch-like system information tool"
|
||||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||||
@@ -502,6 +502,7 @@ if(LINUX)
|
|||||||
src/detection/gpu/gpu_pci.c
|
src/detection/gpu/gpu_pci.c
|
||||||
src/detection/gtk_qt/gtk.c
|
src/detection/gtk_qt/gtk.c
|
||||||
src/detection/host/host_linux.c
|
src/detection/host/host_linux.c
|
||||||
|
src/detection/host/host_mac.c
|
||||||
src/detection/icons/icons_linux.c
|
src/detection/icons/icons_linux.c
|
||||||
src/detection/initsystem/initsystem_linux.c
|
src/detection/initsystem/initsystem_linux.c
|
||||||
src/detection/keyboard/keyboard_linux.c
|
src/detection/keyboard/keyboard_linux.c
|
||||||
@@ -649,6 +650,7 @@ elseif(FreeBSD)
|
|||||||
src/detection/gpu/gpu_pci.c
|
src/detection/gpu/gpu_pci.c
|
||||||
src/detection/gtk_qt/gtk.c
|
src/detection/gtk_qt/gtk.c
|
||||||
src/detection/host/host_bsd.c
|
src/detection/host/host_bsd.c
|
||||||
|
src/detection/host/host_mac.c
|
||||||
src/detection/lm/lm_linux.c
|
src/detection/lm/lm_linux.c
|
||||||
src/detection/icons/icons_linux.c
|
src/detection/icons/icons_linux.c
|
||||||
src/detection/initsystem/initsystem_linux.c
|
src/detection/initsystem/initsystem_linux.c
|
||||||
@@ -881,6 +883,7 @@ elseif(APPLE)
|
|||||||
src/detection/gpu/gpu_apple.c
|
src/detection/gpu/gpu_apple.c
|
||||||
src/detection/gpu/gpu_apple.m
|
src/detection/gpu/gpu_apple.m
|
||||||
src/detection/host/host_apple.c
|
src/detection/host/host_apple.c
|
||||||
|
src/detection/host/host_mac.c
|
||||||
src/detection/icons/icons_nosupport.c
|
src/detection/icons/icons_nosupport.c
|
||||||
src/detection/initsystem/initsystem_linux.c
|
src/detection/initsystem/initsystem_linux.c
|
||||||
src/detection/keyboard/keyboard_apple.c
|
src/detection/keyboard/keyboard_apple.c
|
||||||
@@ -949,6 +952,7 @@ elseif(WIN32)
|
|||||||
src/detection/dns/dns_windows.c
|
src/detection/dns/dns_windows.c
|
||||||
src/detection/font/font_windows.c
|
src/detection/font/font_windows.c
|
||||||
src/detection/gpu/gpu_windows.c
|
src/detection/gpu/gpu_windows.c
|
||||||
|
src/detection/host/host_mac.c
|
||||||
src/detection/host/host_windows.c
|
src/detection/host/host_windows.c
|
||||||
src/detection/icons/icons_windows.c
|
src/detection/icons/icons_windows.c
|
||||||
src/detection/initsystem/initsystem_nosupport.c
|
src/detection/initsystem/initsystem_nosupport.c
|
||||||
|
|||||||
Vendored
+12
@@ -1,3 +1,15 @@
|
|||||||
|
fastfetch (2.32.0) jammy; urgency=medium
|
||||||
|
|
||||||
|
* Update to 2.32.0
|
||||||
|
|
||||||
|
-- Carter Li <zhangsongcui@live.cn> Wed, 18 Dec 2024 10:39:06 +0800
|
||||||
|
|
||||||
|
fastfetch (2.31.0) jammy; urgency=medium
|
||||||
|
|
||||||
|
* Update to 2.31.0
|
||||||
|
|
||||||
|
-- Carter Li <zhangsongcui@live.cn> Wed, 04 Dec 2024 08:41:40 +0800
|
||||||
|
|
||||||
fastfetch (2.30.1) jammy; urgency=medium
|
fastfetch (2.30.1) jammy; urgency=medium
|
||||||
|
|
||||||
* Update to 2.30.1
|
* Update to 2.30.1
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
fastfetch_2.30.1_source.buildinfo universe/utils optional
|
fastfetch_2.32.0_source.buildinfo universe/utils optional
|
||||||
|
|||||||
+1406
-243
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -54,7 +54,7 @@ optionSection = r"""
|
|||||||
Parsing is not case sensitive. E.g. \fB--logo-type\fR is
|
Parsing is not case sensitive. E.g. \fB--logo-type\fR is
|
||||||
equal to \fB--LOGO-TYPE\fR.
|
equal to \fB--LOGO-TYPE\fR.
|
||||||
|
|
||||||
If a value is between square brakets, it is optional.
|
If a value is between square brackets, it is optional.
|
||||||
An optional boolean value defaults to true if not specified.
|
An optional boolean value defaults to true if not specified.
|
||||||
|
|
||||||
More detailed help messages for each options can be printed
|
More detailed help messages for each options can be printed
|
||||||
|
|||||||
+2
-4
@@ -42,7 +42,5 @@ typedef struct FFformatarg
|
|||||||
|
|
||||||
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
|
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
|
||||||
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
|
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
|
||||||
#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, numArgs, arguments) do {\
|
#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, arguments) \
|
||||||
static_assert(sizeof(arguments) / sizeof(*arguments) == (numArgs), "Invalid number of format arguments");\
|
ffParseFormatString((buffer), (formatstr), sizeof(arguments) / sizeof(*arguments), (arguments));
|
||||||
ffParseFormatString((buffer), (formatstr), (numArgs), (arguments));\
|
|
||||||
} while (0)
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
#include "common/time.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
@@ -145,10 +146,10 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o
|
|||||||
if (wordexp(in, &exp, 0) != 0)
|
if (wordexp(in, &exp, 0) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (exp.we_wordc == 1)
|
if (exp.we_wordc >= 1)
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
ffStrbufSetS(out, exp.we_wordv[0]);
|
ffStrbufSetS(out, exp.we_wordv[exp.we_wordc > 1 ? ffTimeGetNow() % exp.we_wordc : 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
wordfree(&exp);
|
wordfree(&exp);
|
||||||
@@ -159,10 +160,10 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o
|
|||||||
if (glob(in, GLOB_NOSORT | GLOB_TILDE, NULL, &gb) != 0)
|
if (glob(in, GLOB_NOSORT | GLOB_TILDE, NULL, &gb) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (gb.gl_matchc == 1)
|
if (gb.gl_matchc >= 1)
|
||||||
{
|
{
|
||||||
result = true;
|
result = true;
|
||||||
ffStrbufSetS(out, gb.gl_pathv[0]);
|
ffStrbufSetS(out, gb.gl_pathv[gb.gl_matchc > 1 ? ffTimeGetNow() % gb.gl_matchc : 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
globfree(&gb);
|
globfree(&gb);
|
||||||
|
|||||||
+15
-23
@@ -6,6 +6,20 @@ struct yyjson_val;
|
|||||||
struct yyjson_mut_doc;
|
struct yyjson_mut_doc;
|
||||||
struct yyjson_mut_val;
|
struct yyjson_mut_val;
|
||||||
|
|
||||||
|
typedef struct FFModuleFormatArg
|
||||||
|
{
|
||||||
|
const char* desc;
|
||||||
|
const char* name;
|
||||||
|
} FFModuleFormatArg;
|
||||||
|
|
||||||
|
typedef struct FFModuleFormatArgList
|
||||||
|
{
|
||||||
|
FFModuleFormatArg* args;
|
||||||
|
uint32_t count;
|
||||||
|
} FFModuleFormatArgList;
|
||||||
|
|
||||||
|
#define FF_FORMAT_ARG_LIST(list) { .args = list, .count = sizeof(list) / sizeof(FFModuleFormatArg) }
|
||||||
|
|
||||||
// Must be the first field of FFModuleOptions
|
// Must be the first field of FFModuleOptions
|
||||||
typedef struct FFModuleBaseInfo
|
typedef struct FFModuleBaseInfo
|
||||||
{
|
{
|
||||||
@@ -19,32 +33,10 @@ typedef struct FFModuleBaseInfo
|
|||||||
void (*parseJsonObject)(void* options, struct yyjson_val *module);
|
void (*parseJsonObject)(void* options, struct yyjson_val *module);
|
||||||
void (*printModule)(void* options);
|
void (*printModule)(void* options);
|
||||||
void (*generateJsonResult)(void* options, struct yyjson_mut_doc* doc, struct yyjson_mut_val* module);
|
void (*generateJsonResult)(void* options, struct yyjson_mut_doc* doc, struct yyjson_mut_val* module);
|
||||||
void (*printHelpFormat)(void);
|
|
||||||
void (*generateJsonConfig)(void* options, struct yyjson_mut_doc* doc, struct yyjson_mut_val* obj);
|
void (*generateJsonConfig)(void* options, struct yyjson_mut_doc* doc, struct yyjson_mut_val* obj);
|
||||||
|
FFModuleFormatArgList formatArgs;
|
||||||
} FFModuleBaseInfo;
|
} FFModuleBaseInfo;
|
||||||
|
|
||||||
static inline void ffOptionInitModuleBaseInfo(
|
|
||||||
FFModuleBaseInfo* baseInfo,
|
|
||||||
const char* name,
|
|
||||||
const char* description,
|
|
||||||
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* generateJsonResult, // void (*const generateJsonResult)(void* options, yyjson_mut_doc* doc, yyjson_mut_val* obj)
|
|
||||||
void (*printHelpFormat)(void),
|
|
||||||
void* generateJsonConfig // void (*const generateJsonConfig)(void* options, yyjson_mut_doc* doc, yyjson_mut_val* obj)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
baseInfo->name = name;
|
|
||||||
baseInfo->description = description;
|
|
||||||
baseInfo->parseCommandOptions = (__typeof__(baseInfo->parseCommandOptions)) parseCommandOptions;
|
|
||||||
baseInfo->parseJsonObject = (__typeof__(baseInfo->parseJsonObject)) parseJsonObject;
|
|
||||||
baseInfo->printModule = (__typeof__(baseInfo->printModule)) printModule;
|
|
||||||
baseInfo->generateJsonResult = (__typeof__(baseInfo->generateJsonResult)) generateJsonResult;
|
|
||||||
baseInfo->printHelpFormat = printHelpFormat;
|
|
||||||
baseInfo->generateJsonConfig = (__typeof__(baseInfo->generateJsonConfig)) generateJsonConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef enum __attribute__((__packed__)) FFModuleKeyType
|
typedef enum __attribute__((__packed__)) FFModuleKeyType
|
||||||
{
|
{
|
||||||
FF_MODULE_KEY_TYPE_NONE = 0,
|
FF_MODULE_KEY_TYPE_NONE = 0,
|
||||||
|
|||||||
+1
-16
@@ -50,7 +50,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 2, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(moduleIndex, "index"),
|
FF_FORMAT_ARG(moduleIndex, "index"),
|
||||||
FF_FORMAT_ARG(moduleArgs->keyIcon, "icon"),
|
FF_FORMAT_ARG(moduleArgs->keyIcon, "icon"),
|
||||||
}));
|
}));
|
||||||
@@ -148,18 +148,3 @@ void ffPrintCharTimes(char c, uint32_t times)
|
|||||||
if(remaining > 0)
|
if(remaining > 0)
|
||||||
fwrite(str, 1, remaining, stdout);
|
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 + 1, args[i]);
|
|
||||||
|
|
||||||
printf("The default is something similar to \"%s\".\n", def);
|
|
||||||
}
|
|
||||||
|
|||||||
+2
-10
@@ -14,16 +14,8 @@ typedef enum __attribute__((__packed__)) FFPrintType {
|
|||||||
|
|
||||||
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType);
|
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType);
|
||||||
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
|
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
|
||||||
#define FF_PRINT_FORMAT_CHECKED(moduleName, moduleIndex, moduleArgs, printType, numArgs, arguments) do {\
|
#define FF_PRINT_FORMAT_CHECKED(moduleName, moduleIndex, moduleArgs, printType, arguments) \
|
||||||
static_assert(sizeof(arguments) / sizeof(*arguments) == (numArgs), "Invalid number of format arguments");\
|
ffPrintFormat((moduleName), (moduleIndex), (moduleArgs), (printType), (sizeof(arguments) / sizeof(*arguments)), (arguments));
|
||||||
ffPrintFormat((moduleName), (moduleIndex), (moduleArgs), (printType), (numArgs), (arguments));\
|
|
||||||
} while (0)
|
|
||||||
FF_C_PRINTF(5, 6) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
|
FF_C_PRINTF(5, 6) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
|
||||||
void ffPrintColor(const FFstrbuf* colorValue);
|
void ffPrintColor(const FFstrbuf* colorValue);
|
||||||
void ffPrintCharTimes(char c, uint32_t times);
|
void ffPrintCharTimes(char c, uint32_t times);
|
||||||
|
|
||||||
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
|
|
||||||
#define FF_PRINT_MODULE_FORMAT_HELP_CHECKED(moduleName, def, numArgs, args) do {\
|
|
||||||
static_assert(sizeof(args) / sizeof(*args) == (numArgs), "Invalid number of format arguments");\
|
|
||||||
ffPrintModuleFormatHelp((moduleName), (def), (numArgs), (args));\
|
|
||||||
} while (0)
|
|
||||||
|
|||||||
@@ -168,7 +168,8 @@ static const char* qcomPartId2name(uint32_t partId)
|
|||||||
{
|
{
|
||||||
switch (partId)
|
switch (partId)
|
||||||
{
|
{
|
||||||
case 0x001: return "Oryon";
|
case 0x001: return "Oryon 1";
|
||||||
|
case 0x002: return "Oryon 2";
|
||||||
case 0x00f: return "Scorpion";
|
case 0x00f: return "Scorpion";
|
||||||
case 0x02d: return "Scorpion";
|
case 0x02d: return "Scorpion";
|
||||||
case 0x04d: return "Krait";
|
case 0x04d: return "Krait";
|
||||||
@@ -262,6 +263,9 @@ static const char* applePartId2name(uint32_t partId)
|
|||||||
case 0x037: return "Everest-A16";
|
case 0x037: return "Everest-A16";
|
||||||
case 0x038: return "Blizzard-M2-Max";
|
case 0x038: return "Blizzard-M2-Max";
|
||||||
case 0x039: return "Avalanche-M2-Max";
|
case 0x039: return "Avalanche-M2-Max";
|
||||||
|
case 0x046: return "Sawtooth-M11";
|
||||||
|
case 0x048: return "Sawtooth-M3-Max";
|
||||||
|
case 0x049: return "Everest-M3-Max";
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,28 +170,33 @@ static void detectArmName(FFstrbuf* cpuinfo, FFCPUResult* cpu, uint32_t implId)
|
|||||||
if (!ffStrStartsWith(line, "CPU part\t: ")) continue;
|
if (!ffStrStartsWith(line, "CPU part\t: ")) continue;
|
||||||
uint32_t partId = (uint32_t) strtoul(line + strlen("CPU part\t: "), NULL, 16);
|
uint32_t partId = (uint32_t) strtoul(line + strlen("CPU part\t: "), NULL, 16);
|
||||||
const char* name = NULL;
|
const char* name = NULL;
|
||||||
if (partId > 0) // Linux reports 0 for unknown CPUs
|
switch (implId)
|
||||||
{
|
{
|
||||||
switch (implId)
|
case 0x41: name = armPartId2name(partId); break;
|
||||||
{
|
case 0x42: name = brcmPartId2name(partId); break;
|
||||||
case 0x41: name = armPartId2name(partId); break;
|
case 0x43: name = caviumPartId2name(partId); break;
|
||||||
case 0x42: name = brcmPartId2name(partId); break;
|
case 0x44: name = decPartId2name(partId); break;
|
||||||
case 0x43: name = caviumPartId2name(partId); break;
|
case 0x46: name = fujitsuPartId2name(partId); break;
|
||||||
case 0x44: name = decPartId2name(partId); break;
|
case 0x48: name = hisiPartId2name(partId); break;
|
||||||
case 0x46: name = fujitsuPartId2name(partId); break;
|
case 0x4e: name = nvidiaPartId2name(partId); break;
|
||||||
case 0x48: name = hisiPartId2name(partId); break;
|
case 0x50: name = apmPartId2name(partId); break;
|
||||||
case 0x4e: name = nvidiaPartId2name(partId); break;
|
case 0x51: name = qcomPartId2name(partId); break;
|
||||||
case 0x50: name = apmPartId2name(partId); break;
|
case 0x53: name = samsungPartId2name(partId); break;
|
||||||
case 0x51: name = qcomPartId2name(partId); break;
|
case 0x56: name = marvellPartId2name(partId); break;
|
||||||
case 0x53: name = samsungPartId2name(partId); break;
|
case 0x61:
|
||||||
case 0x56: name = marvellPartId2name(partId); break;
|
if (partId == 0)
|
||||||
case 0x61: name = applePartId2name(partId); break;
|
{
|
||||||
case 0x66: name = faradayPartId2name(partId); break;
|
// https://github.com/Dr-Noob/cpufetch/issues/213#issuecomment-1927782105
|
||||||
case 0x69: name = intelPartId2name(partId); break;
|
ffStrbufSetStatic(&cpu->name, "Virtualized Apple Silicon");
|
||||||
case 0x6d: name = msPartId2name(partId); break;
|
return;
|
||||||
case 0x70: name = ftPartId2name(partId); break;
|
}
|
||||||
case 0xc0: name = amperePartId2name(partId); break;
|
name = applePartId2name(partId);
|
||||||
}
|
break;
|
||||||
|
case 0x66: name = faradayPartId2name(partId); break;
|
||||||
|
case 0x69: name = intelPartId2name(partId); break;
|
||||||
|
case 0x6d: name = msPartId2name(partId); break;
|
||||||
|
case 0x70: name = ftPartId2name(partId); break;
|
||||||
|
case 0xc0: name = amperePartId2name(partId); break;
|
||||||
}
|
}
|
||||||
if (lastPartId != partId)
|
if (lastPartId != partId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,9 @@
|
|||||||
#define FF_WM_PRETTY_ICEWM "IceWM"
|
#define FF_WM_PRETTY_ICEWM "IceWM"
|
||||||
#define FF_WM_PRETTY_SPECTRWM "spectrwm"
|
#define FF_WM_PRETTY_SPECTRWM "spectrwm"
|
||||||
#define FF_WM_PRETTY_DTWM "dtwm"
|
#define FF_WM_PRETTY_DTWM "dtwm"
|
||||||
|
#define FF_WM_PRETTY_FVWM "fvwm"
|
||||||
|
#define FF_WM_PRETTY_CTWM "ctwm"
|
||||||
|
#define FF_WM_PRETTY_RATPOISON "ratpoison"
|
||||||
|
|
||||||
#define FF_WM_PROTOCOL_TTY "TTY"
|
#define FF_WM_PROTOCOL_TTY "TTY"
|
||||||
#define FF_WM_PROTOCOL_X11 "X11"
|
#define FF_WM_PROTOCOL_X11 "X11"
|
||||||
|
|||||||
@@ -126,10 +126,7 @@ static void waylandKdeNameListener(void* data, FF_MAYBE_UNUSED struct kde_output
|
|||||||
WaylandDisplay* display = data;
|
WaylandDisplay* display = data;
|
||||||
display->type = ffdsGetDisplayType(name);
|
display->type = ffdsGetDisplayType(name);
|
||||||
// As display->id is used as an internal identifier, we don't need it to be NUL terminated
|
// As display->id is used as an internal identifier, we don't need it to be NUL terminated
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wstringop-truncation"
|
|
||||||
strncpy((char*) &display->id, name, sizeof(display->id));
|
strncpy((char*) &display->id, name, sizeof(display->id));
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
ffStrbufAppendS(&display->name, name);
|
ffStrbufAppendS(&display->name, name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,18 @@
|
|||||||
#include "kde-output-order-v1-client-protocol.h"
|
#include "kde-output-order-v1-client-protocol.h"
|
||||||
#include "xdg-output-unstable-v1-client-protocol.h"
|
#include "xdg-output-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
#ifdef __linux__
|
#if __FreeBSD__
|
||||||
|
#include <sys/un.h>
|
||||||
|
#include <sys/ucred.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool waylandDetectWM(int fd, FFDisplayServerResult* result)
|
static bool waylandDetectWM(int fd, FFDisplayServerResult* result)
|
||||||
{
|
{
|
||||||
struct ucred ucred;
|
#if __linux__ || (__FreeBSD__ && !__DragonFly__)
|
||||||
|
|
||||||
|
#if __linux
|
||||||
|
struct ucred ucred = {};
|
||||||
socklen_t len = sizeof(ucred);
|
socklen_t len = sizeof(ucred);
|
||||||
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1 || ucred.pid <= 0)
|
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1 || ucred.pid <= 0)
|
||||||
return false;
|
return false;
|
||||||
@@ -30,6 +38,19 @@ static bool waylandDetectWM(int fd, FFDisplayServerResult* result)
|
|||||||
ffStrbufAppendF(&procPath, "/proc/%d/cmdline", ucred.pid); //We check the cmdline for the process name, because it is not trimmed.
|
ffStrbufAppendF(&procPath, "/proc/%d/cmdline", ucred.pid); //We check the cmdline for the process name, because it is not trimmed.
|
||||||
if (!ffReadFileBuffer(procPath.chars, &result->wmProcessName))
|
if (!ffReadFileBuffer(procPath.chars, &result->wmProcessName))
|
||||||
return false;
|
return false;
|
||||||
|
#else
|
||||||
|
struct xucred ucred = {};
|
||||||
|
socklen_t len = sizeof(ucred);
|
||||||
|
if (getsockopt(fd, AF_UNSPEC, LOCAL_PEERCRED, &ucred, &len) == -1 || ucred.cr_pid <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
size_t size = 4096;
|
||||||
|
ffStrbufEnsureFixedLengthFree(&result->wmProcessName, (uint32_t) size);
|
||||||
|
|
||||||
|
if(sysctl((int[]){CTL_KERN, KERN_PROC, KERN_PROC_ARGS, ucred.cr_pid}, 4, result->wmProcessName.chars, &size, NULL, 0 ) != 0)
|
||||||
|
return false;
|
||||||
|
result->wmProcessName.length = (uint32_t) size - 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
// #1135: wl-restart is a special case
|
// #1135: wl-restart is a special case
|
||||||
const char* filename = strrchr(result->wmProcessName.chars, '/');
|
const char* filename = strrchr(result->wmProcessName.chars, '/');
|
||||||
@@ -45,14 +66,12 @@ static bool waylandDetectWM(int fd, FFDisplayServerResult* result)
|
|||||||
ffStrbufSubstrAfterLastC(&result->wmProcessName, '/'); //Trim the path
|
ffStrbufSubstrAfterLastC(&result->wmProcessName, '/'); //Trim the path
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static bool waylandDetectWM(int fd, FFDisplayServerResult* result)
|
|
||||||
{
|
|
||||||
FF_UNUSED(fd, result);
|
FF_UNUSED(fd, result);
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void waylandGlobalAddListener(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
|
static void waylandGlobalAddListener(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
|
||||||
{
|
{
|
||||||
@@ -83,7 +102,7 @@ static void waylandGlobalAddListener(void* data, struct wl_registry* registry, u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool matchDrmConnector(const char* connName, WaylandDisplay* wldata)
|
static FF_MAYBE_UNUSED bool matchDrmConnector(const char* connName, WaylandDisplay* wldata)
|
||||||
{
|
{
|
||||||
// https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-event-name
|
// https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-event-name
|
||||||
// The doc says that "do not assume that the name is a reflection of an underlying DRM connector, X11 connection, etc."
|
// The doc says that "do not assume that the name is a reflection of an underlying DRM connector, X11 connection, etc."
|
||||||
@@ -129,8 +148,10 @@ void ffWaylandOutputNameListener(void* data, FF_MAYBE_UNUSED void* output, const
|
|||||||
if (display->id) return;
|
if (display->id) return;
|
||||||
|
|
||||||
display->type = ffdsGetDisplayType(name);
|
display->type = ffdsGetDisplayType(name);
|
||||||
|
#if __linux__
|
||||||
if (!display->edidName.length)
|
if (!display->edidName.length)
|
||||||
matchDrmConnector(name, display);
|
matchDrmConnector(name, display);
|
||||||
|
#endif
|
||||||
display->id = ffWaylandGenerateIdFromName(name);
|
display->id = ffWaylandGenerateIdFromName(name);
|
||||||
ffStrbufAppendS(&display->name, name);
|
ffStrbufAppendS(&display->name, name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,8 +126,14 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* name)
|
|||||||
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_ICEWM);
|
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_ICEWM);
|
||||||
else if(ffStrEqualsIgnCase(name, "dtwm"))
|
else if(ffStrEqualsIgnCase(name, "dtwm"))
|
||||||
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_DTWM);
|
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_DTWM);
|
||||||
|
else if(ffStrEqualsIgnCase(name, "fvwm"))
|
||||||
|
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_FVWM);
|
||||||
|
else if(ffStrEqualsIgnCase(name, "ctwm"))
|
||||||
|
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_CTWM);
|
||||||
else if(ffStrEqualsIgnCase(name, "hyprland"))
|
else if(ffStrEqualsIgnCase(name, "hyprland"))
|
||||||
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_HYPRLAND);
|
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_HYPRLAND);
|
||||||
|
else if(ffStrEqualsIgnCase(name, "ratpoison"))
|
||||||
|
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_RATPOISON);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void applyNameIfWM(FFDisplayServerResult* result, const char* processName)
|
static void applyNameIfWM(FFDisplayServerResult* result, const char* processName)
|
||||||
@@ -296,10 +302,10 @@ static const char* getFromProcesses(FFDisplayServerResult* result)
|
|||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if(result->dePrettyName.length == 0)
|
if(result->dePrettyName.length == 0)
|
||||||
applyPrettyNameIfDE(result, proc->p_comm);
|
applyPrettyNameIfDE(result, proc[i].p_comm);
|
||||||
|
|
||||||
if(result->wmPrettyName.length == 0)
|
if(result->wmPrettyName.length == 0)
|
||||||
applyNameIfWM(result, proc->p_comm);
|
applyNameIfWM(result, proc[i].p_comm);
|
||||||
|
|
||||||
if(result->dePrettyName.length > 0 && result->wmPrettyName.length > 0)
|
if(result->dePrettyName.length > 0 && result->wmPrettyName.length > 0)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -188,7 +188,6 @@ static bool xcbRandrHandleCrtc(XcbRandrData* data, xcb_randr_crtc_t crtc, FFstrb
|
|||||||
{
|
{
|
||||||
item->hdrStatus = ffEdidGetHdrCompatible(edidData, (uint32_t) edidLength) ? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
|
item->hdrStatus = ffEdidGetHdrCompatible(edidData, (uint32_t) edidLength) ? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
|
||||||
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
|
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
|
||||||
ffEdidGetPhysicalSize(edidData, &item->physicalWidth, &item->physicalHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!item;
|
return !!item;
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ static bool xrandrHandleCrtc(XrandrData* data, XRROutputInfo* output, FFstrbuf*
|
|||||||
{
|
{
|
||||||
item->hdrStatus = ffEdidGetHdrCompatible(edidData, edidLength) ? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
|
item->hdrStatus = ffEdidGetHdrCompatible(edidData, edidLength) ? FF_DISPLAY_HDR_STATUS_SUPPORTED : FF_DISPLAY_HDR_STATUS_UNSUPPORTED;
|
||||||
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
|
ffEdidGetSerialAndManufactureDate(edidData, &item->serial, &item->manufactureYear, &item->manufactureWeek);
|
||||||
ffEdidGetPhysicalSize(edidData, &item->physicalWidth, &item->physicalHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data->ffXRRFreeCrtcInfo(crtcInfo);
|
data->ffXRRFreeCrtcInfo(crtcInfo);
|
||||||
|
|||||||
@@ -3,10 +3,14 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#ifndef _PATH_LOCALBASE
|
#ifndef _PATH_LOCALBASE
|
||||||
#define _PATH_LOCALBASE "/usr/local"
|
#define _PATH_LOCALBASE "/usr/local"
|
||||||
#endif
|
#endif
|
||||||
|
#elif __OpenBSD__
|
||||||
|
#define _PATH_LOCALBASE "/usr/local"
|
||||||
|
#elif __NetBSD__
|
||||||
|
#define _PATH_LOCALBASE "/usr/pkg"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FF_HAVE_EMBEDDED_PCIIDS
|
#if FF_HAVE_EMBEDDED_PCIIDS
|
||||||
@@ -37,17 +41,10 @@ static const FFstrbuf* loadPciIds()
|
|||||||
if (pciids.length == 0)
|
if (pciids.length == 0)
|
||||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/local/share/hwdata/pci.ids", &pciids);
|
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/local/share/hwdata/pci.ids", &pciids);
|
||||||
}
|
}
|
||||||
#elif __FreeBSD__
|
#elif __FreeBSD__ || __OpenBSD__ || __NetBSD__
|
||||||
// https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/pciconf/pathnames.h
|
|
||||||
ffReadFileBuffer(_PATH_LOCALBASE "/share/pciids/pci.ids", &pciids);
|
ffReadFileBuffer(_PATH_LOCALBASE "/share/pciids/pci.ids", &pciids);
|
||||||
if (pciids.length == 0)
|
|
||||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/share/pciids/pci.ids", &pciids);
|
|
||||||
#elif __sun
|
#elif __sun
|
||||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/usr/share/hwdata/pci.ids", &pciids);
|
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/usr/share/hwdata/pci.ids", &pciids);
|
||||||
#elif __OpenBSD__
|
|
||||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/usr/local/share/pci.ids", &pciids);
|
|
||||||
#elif __NetBSD__
|
|
||||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/usr/pkg/share/pciutils/pci.ids", &pciids);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // FF_CUSTOM_PCI_IDS_PATH
|
#endif // FF_CUSTOM_PCI_IDS_PATH
|
||||||
|
|||||||
@@ -13,4 +13,8 @@ typedef struct FFHostResult
|
|||||||
FFstrbuf vendor;
|
FFstrbuf vendor;
|
||||||
} FFHostResult;
|
} FFHostResult;
|
||||||
|
|
||||||
|
const char* ffHostGetMacProductNameWithHwModel(const FFstrbuf* hwModel);
|
||||||
|
#ifdef __x86_64__
|
||||||
|
bool ffHostDetectMac(FFHostResult* host);
|
||||||
|
#endif
|
||||||
const char* ffDetectHost(FFHostResult* host);
|
const char* ffDetectHost(FFHostResult* host);
|
||||||
|
|||||||
@@ -5,179 +5,6 @@
|
|||||||
|
|
||||||
#include <IOKit/IOKitLib.h>
|
#include <IOKit/IOKitLib.h>
|
||||||
|
|
||||||
static const char* getProductNameWithHwModel(const FFstrbuf* hwModel)
|
|
||||||
{
|
|
||||||
// Macbook Pro: https://support.apple.com/en-us/HT201300
|
|
||||||
// Macbook Air: https://support.apple.com/en-us/HT201862
|
|
||||||
// Mac mini: https://support.apple.com/en-us/HT201894
|
|
||||||
// iMac: https://support.apple.com/en-us/HT201634
|
|
||||||
// Mac Pro: https://support.apple.com/en-us/HT202888
|
|
||||||
// Mac Studio: https://support.apple.com/en-us/HT213073
|
|
||||||
|
|
||||||
if(ffStrbufStartsWithS(hwModel, "MacBookPro"))
|
|
||||||
{
|
|
||||||
const char* version = hwModel->chars + strlen("MacBookPro");
|
|
||||||
if(ffStrEquals(version, "18,3") ||
|
|
||||||
ffStrEquals(version, "18,4")) return "MacBook Pro (14-inch, 2021)";
|
|
||||||
if(ffStrEquals(version, "18,1") ||
|
|
||||||
ffStrEquals(version, "18,2")) return "MacBook Pro (16-inch, 2021)";
|
|
||||||
if(ffStrEquals(version, "17,1")) return "MacBook Pro (13-inch, M1, 2020)";
|
|
||||||
if(ffStrEquals(version, "16,3")) return "MacBook Pro (13-inch, 2020, Two Thunderbolt 3 ports)";
|
|
||||||
if(ffStrEquals(version, "16,2")) return "MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)";
|
|
||||||
if(ffStrEquals(version, "16,4") ||
|
|
||||||
ffStrEquals(version, "16,1")) return "MacBook Pro (16-inch, 2019)";
|
|
||||||
if(ffStrEquals(version, "15,4")) return "MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports)";
|
|
||||||
if(ffStrEquals(version, "15,3")) return "MacBook Pro (15-inch, 2019)";
|
|
||||||
if(ffStrEquals(version, "15,2")) return "MacBook Pro (13-inch, 2018/2019, Four Thunderbolt 3 ports)";
|
|
||||||
if(ffStrEquals(version, "15,1")) return "MacBook Pro (15-inch, 2018/2019)";
|
|
||||||
if(ffStrEquals(version, "14,3")) return "MacBook Pro (15-inch, 2017)";
|
|
||||||
if(ffStrEquals(version, "14,2")) return "MacBook Pro (13-inch, 2017, Four Thunderbolt 3 ports)";
|
|
||||||
if(ffStrEquals(version, "14,1")) return "MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)";
|
|
||||||
if(ffStrEquals(version, "13,3")) return "MacBook Pro (15-inch, 2016)";
|
|
||||||
if(ffStrEquals(version, "13,2")) return "MacBook Pro (13-inch, 2016, Four Thunderbolt 3 ports)";
|
|
||||||
if(ffStrEquals(version, "13,1")) return "MacBook Pro (13-inch, 2016, Two Thunderbolt 3 ports)";
|
|
||||||
if(ffStrEquals(version, "12,1")) return "MacBook Pro (Retina, 13-inch, Early 2015)";
|
|
||||||
if(ffStrEquals(version, "11,4") ||
|
|
||||||
ffStrEquals(version, "11,5")) return "MacBook Pro (Retina, 15-inch, Mid 2015)";
|
|
||||||
if(ffStrEquals(version, "11,2") ||
|
|
||||||
ffStrEquals(version, "11,3")) return "MacBook Pro (Retina, 15-inch, Late 2013/Mid 2014)";
|
|
||||||
if(ffStrEquals(version, "11,1")) return "MacBook Pro (Retina, 13-inch, Late 2013/Mid 2014)";
|
|
||||||
if(ffStrEquals(version, "10,2")) return "MacBook Pro (Retina, 13-inch, Late 2012/Early 2013)";
|
|
||||||
if(ffStrEquals(version, "10,1")) return "MacBook Pro (Retina, 15-inch, Mid 2012/Early 2013)";
|
|
||||||
if(ffStrEquals(version, "9,2")) return "MacBook Pro (13-inch, Mid 2012)";
|
|
||||||
if(ffStrEquals(version, "9,1")) return "MacBook Pro (15-inch, Mid 2012)";
|
|
||||||
if(ffStrEquals(version, "8,3")) return "MacBook Pro (17-inch, 2011)";
|
|
||||||
if(ffStrEquals(version, "8,2")) return "MacBook Pro (15-inch, 2011)";
|
|
||||||
if(ffStrEquals(version, "8,1")) return "MacBook Pro (13-inch, 2011)";
|
|
||||||
if(ffStrEquals(version, "7,1")) return "MacBook Pro (13-inch, Mid 2010)";
|
|
||||||
if(ffStrEquals(version, "6,2")) return "MacBook Pro (15-inch, Mid 2010)";
|
|
||||||
if(ffStrEquals(version, "6,1")) return "MacBook Pro (17-inch, Mid 2010)";
|
|
||||||
if(ffStrEquals(version, "5,5")) return "MacBook Pro (13-inch, Mid 2009)";
|
|
||||||
if(ffStrEquals(version, "5,3")) return "MacBook Pro (15-inch, Mid 2009)";
|
|
||||||
if(ffStrEquals(version, "5,2")) return "MacBook Pro (17-inch, Mid/Early 2009)";
|
|
||||||
if(ffStrEquals(version, "5,1")) return "MacBook Pro (15-inch, Late 2008)";
|
|
||||||
if(ffStrEquals(version, "4,1")) return "MacBook Pro (17/15-inch, Early 2008)";
|
|
||||||
}
|
|
||||||
else if(ffStrbufStartsWithS(hwModel, "MacBookAir"))
|
|
||||||
{
|
|
||||||
const char* version = hwModel->chars + strlen("MacBookAir");
|
|
||||||
if(ffStrEquals(version, "10,1")) return "MacBook Air (M1, 2020)";
|
|
||||||
if(ffStrEquals(version, "9,1")) return "MacBook Air (Retina, 13-inch, 2020)";
|
|
||||||
if(ffStrEquals(version, "8,2")) return "MacBook Air (Retina, 13-inch, 2019)";
|
|
||||||
if(ffStrEquals(version, "8,1")) return "MacBook Air (Retina, 13-inch, 2018)";
|
|
||||||
if(ffStrEquals(version, "7,2")) return "MacBook Air (13-inch, Early 2015/2017)";
|
|
||||||
if(ffStrEquals(version, "7,1")) return "MacBook Air (11-inch, Early 2015)";
|
|
||||||
if(ffStrEquals(version, "6,2")) return "MacBook Air (13-inch, Mid 2013/Early 2014)";
|
|
||||||
if(ffStrEquals(version, "6,1")) return "MacBook Air (11-inch, Mid 2013/Early 2014)";
|
|
||||||
if(ffStrEquals(version, "5,2")) return "MacBook Air (13-inch, Mid 2012)";
|
|
||||||
if(ffStrEquals(version, "5,1")) return "MacBook Air (11-inch, Mid 2012)";
|
|
||||||
if(ffStrEquals(version, "4,2")) return "MacBook Air (13-inch, Mid 2011)";
|
|
||||||
if(ffStrEquals(version, "4,1")) return "MacBook Air (11-inch, Mid 2011)";
|
|
||||||
if(ffStrEquals(version, "3,2")) return "MacBook Air (13-inch, Late 2010)";
|
|
||||||
if(ffStrEquals(version, "3,1")) return "MacBook Air (11-inch, Late 2010)";
|
|
||||||
if(ffStrEquals(version, "2,1")) return "MacBook Air (Mid 2009)";
|
|
||||||
}
|
|
||||||
else if(ffStrbufStartsWithS(hwModel, "Macmini"))
|
|
||||||
{
|
|
||||||
const char* version = hwModel->chars + strlen("Macmini");
|
|
||||||
if(ffStrEquals(version, "9,1")) return "Mac mini (M1, 2020)";
|
|
||||||
if(ffStrEquals(version, "8,1")) return "Mac mini (2018)";
|
|
||||||
if(ffStrEquals(version, "7,1")) return "Mac mini (Mid 2014)";
|
|
||||||
if(ffStrEquals(version, "6,1") ||
|
|
||||||
ffStrEquals(version, "6,2")) return "Mac mini (Late 2012)";
|
|
||||||
if(ffStrEquals(version, "5,1") ||
|
|
||||||
ffStrEquals(version, "5,2")) return "Mac mini (Mid 2011)";
|
|
||||||
if(ffStrEquals(version, "4,1")) return "Mac mini (Mid 2010)";
|
|
||||||
if(ffStrEquals(version, "3,1")) return "Mac mini (Early/Late 2009)";
|
|
||||||
}
|
|
||||||
else if(ffStrbufStartsWithS(hwModel, "MacBook"))
|
|
||||||
{
|
|
||||||
const char* version = hwModel->chars + strlen("MacBook");
|
|
||||||
if(ffStrEquals(version, "10,1")) return "MacBook (Retina, 12-inch, 2017)";
|
|
||||||
if(ffStrEquals(version, "9,1")) return "MacBook (Retina, 12-inch, Early 2016)";
|
|
||||||
if(ffStrEquals(version, "8,1")) return "MacBook (Retina, 12-inch, Early 2015)";
|
|
||||||
if(ffStrEquals(version, "7,1")) return "MacBook (13-inch, Mid 2010)";
|
|
||||||
if(ffStrEquals(version, "6,1")) return "MacBook (13-inch, Late 2009)";
|
|
||||||
if(ffStrEquals(version, "5,2")) return "MacBook (13-inch, Early/Mid 2009)";
|
|
||||||
}
|
|
||||||
else if(ffStrbufStartsWithS(hwModel, "MacPro"))
|
|
||||||
{
|
|
||||||
const char* version = hwModel->chars + strlen("MacPro");
|
|
||||||
if(ffStrEquals(version, "7,1")) return "Mac Pro (2019)";
|
|
||||||
if(ffStrEquals(version, "6,1")) return "Mac Pro (Late 2013)";
|
|
||||||
if(ffStrEquals(version, "5,1")) return "Mac Pro (Mid 2010 - Mid 2012)";
|
|
||||||
if(ffStrEquals(version, "4,1")) return "Mac Pro (Early 2009)";
|
|
||||||
}
|
|
||||||
else if(ffStrbufStartsWithS(hwModel, "Mac"))
|
|
||||||
{
|
|
||||||
const char* version = hwModel->chars + strlen("Mac");
|
|
||||||
if(ffStrEquals(version, "16,3")) return "iMac (24-inch, 2024, Four Thunderbolt / USB 4 ports)";
|
|
||||||
if(ffStrEquals(version, "16,2")) return "iMac (24-inch, 2024, Two Thunderbolt / USB 4 ports)";
|
|
||||||
if(ffStrEquals(version, "16,1") ||
|
|
||||||
ffStrEquals(version, "16,6") ||
|
|
||||||
ffStrEquals(version, "16,8")) return "MacBook Pro (14-inch, 2024, Three Thunderbolt 4 ports)";
|
|
||||||
if(ffStrEquals(version, "16,7") ||
|
|
||||||
ffStrEquals(version, "16,5")) return "MacBook Pro (16-inch, 2024, Three Thunderbolt 4 ports)";
|
|
||||||
if(ffStrEquals(version, "16,15") ||
|
|
||||||
ffStrEquals(version, "16,10")) return "Mac mini (2024)";
|
|
||||||
if(ffStrEquals(version, "15,13")) return "MacBook Air (15-inch, M3, 2024)";
|
|
||||||
if(ffStrEquals(version, "15,2")) return "MacBook Air (13-inch, M3, 2024)";
|
|
||||||
if(ffStrEquals(version, "15,3")) return "MacBook Pro (14-inch, Nov 2023, Two Thunderbolt / USB 4 ports)";
|
|
||||||
if(ffStrEquals(version, "15,4")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports)";
|
|
||||||
if(ffStrEquals(version, "15,5")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports, Two USB 3 ports)";
|
|
||||||
if(ffStrEquals(version, "15,6") ||
|
|
||||||
ffStrEquals(version, "15,8") ||
|
|
||||||
ffStrEquals(version, "15,10")) return "MacBook Pro (14-inch, Nov 2023, Three Thunderbolt 4 ports)";
|
|
||||||
if(ffStrEquals(version, "15,7") ||
|
|
||||||
ffStrEquals(version, "15,9") ||
|
|
||||||
ffStrEquals(version, "15,11")) return "MacBook Pro (16-inch, Nov 2023, Three Thunderbolt 4 ports)";
|
|
||||||
if(ffStrEquals(version, "14,15")) return "MacBook Air (15-inch, M2, 2023)";
|
|
||||||
if(ffStrEquals(version, "14,14")) return "Mac Studio (M2 Ultra, 2023, Two Thunderbolt 4 front ports)";
|
|
||||||
if(ffStrEquals(version, "14,13")) return "Mac Studio (M2 Max, 2023, Two USB-C front ports)";
|
|
||||||
if(ffStrEquals(version, "14,8")) return "Mac Pro (2023)";
|
|
||||||
if(ffStrEquals(version, "14,6") ||
|
|
||||||
ffStrEquals(version, "14,10")) return "MacBook Pro (16-inch, 2023)";
|
|
||||||
if(ffStrEquals(version, "14,5") ||
|
|
||||||
ffStrEquals(version, "14,9")) return "MacBook Pro (14-inch, 2023)";
|
|
||||||
if(ffStrEquals(version, "14,3")) return "Mac mini (M2, 2023, Two Thunderbolt 4 ports)";
|
|
||||||
if(ffStrEquals(version, "14,12")) return "Mac mini (M2, 2023, Four Thunderbolt 4 ports)";
|
|
||||||
if(ffStrEquals(version, "14,7")) return "MacBook Pro (13-inch, M2, 2022)";
|
|
||||||
if(ffStrEquals(version, "14,2")) return "MacBook Air (M2, 2022)";
|
|
||||||
if(ffStrEquals(version, "13,1")) return "Mac Studio (M1 Max, 2022, Two USB-C front ports)";
|
|
||||||
if(ffStrEquals(version, "13,2")) return "Mac Studio (M1 Ultra, 2022, Two Thunderbolt 4 front ports)";
|
|
||||||
}
|
|
||||||
else if(ffStrbufStartsWithS(hwModel, "iMac"))
|
|
||||||
{
|
|
||||||
const char* version = hwModel->chars + strlen("iMac");
|
|
||||||
if(ffStrEquals(version, "21,1")) return "iMac (24-inch, M1, 2021, Two Thunderbolt / USB 4 ports, Two USB 3 ports)";
|
|
||||||
if(ffStrEquals(version, "21,2")) return "iMac (24-inch, M1, 2021, Two Thunderbolt / USB 4 ports)";
|
|
||||||
if(ffStrEquals(version, "20,1") ||
|
|
||||||
ffStrEquals(version, "20,2")) return "iMac (Retina 5K, 27-inch, 2020)";
|
|
||||||
if(ffStrEquals(version, "19,1")) return "iMac (Retina 5K, 27-inch, 2019)";
|
|
||||||
if(ffStrEquals(version, "19,2")) return "iMac (Retina 4K, 21.5-inch, 2019)";
|
|
||||||
if(ffStrEquals(version, "Pro1,1")) return "iMac Pro (2017)";
|
|
||||||
if(ffStrEquals(version, "18,3")) return "iMac (Retina 5K, 27-inch, 2017)";
|
|
||||||
if(ffStrEquals(version, "18,2")) return "iMac (Retina 4K, 21.5-inch, 2017)";
|
|
||||||
if(ffStrEquals(version, "18,1")) return "iMac (21.5-inch, 2017)";
|
|
||||||
if(ffStrEquals(version, "17,1")) return "iMac (Retina 5K, 27-inch, Late 2015)";
|
|
||||||
if(ffStrEquals(version, "16,2")) return "iMac (Retina 4K, 21.5-inch, Late 2015)";
|
|
||||||
if(ffStrEquals(version, "16,1")) return "iMac (21.5-inch, Late 2015)";
|
|
||||||
if(ffStrEquals(version, "15,1")) return "iMac (Retina 5K, 27-inch, Late 2014 - Mid 2015)";
|
|
||||||
if(ffStrEquals(version, "14,4")) return "iMac (21.5-inch, Mid 2014)";
|
|
||||||
if(ffStrEquals(version, "14,2")) return "iMac (27-inch, Late 2013)";
|
|
||||||
if(ffStrEquals(version, "14,1")) return "iMac (21.5-inch, Late 2013)";
|
|
||||||
if(ffStrEquals(version, "13,2")) return "iMac (27-inch, Late 2012)";
|
|
||||||
if(ffStrEquals(version, "13,1")) return "iMac (21.5-inch, Late 2012)";
|
|
||||||
if(ffStrEquals(version, "12,2")) return "iMac (27-inch, Mid 2011)";
|
|
||||||
if(ffStrEquals(version, "12,1")) return "iMac (21.5-inch, Mid 2011)";
|
|
||||||
if(ffStrEquals(version, "11,3")) return "iMac (27-inch, Mid 2010)";
|
|
||||||
if(ffStrEquals(version, "11,2")) return "iMac (21.5-inch, Mid 2010)";
|
|
||||||
if(ffStrEquals(version, "10,1")) return "iMac (27/21.5-inch, Late 2009)";
|
|
||||||
if(ffStrEquals(version, "9,1")) return "iMac (24/20-inch, Early 2009)";
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* getProductNameWithIokit(FFstrbuf* result)
|
const char* getProductNameWithIokit(FFstrbuf* result)
|
||||||
{
|
{
|
||||||
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t registryEntry = IOServiceGetMatchingService(MACH_PORT_NULL, IOServiceNameMatching("product"));
|
FF_IOOBJECT_AUTO_RELEASE io_registry_entry_t registryEntry = IOServiceGetMatchingService(MACH_PORT_NULL, IOServiceNameMatching("product"));
|
||||||
@@ -217,7 +44,7 @@ const char* ffDetectHost(FFHostResult* host)
|
|||||||
const char* error = ffSysctlGetString("hw.model", &host->family);
|
const char* error = ffSysctlGetString("hw.model", &host->family);
|
||||||
if (error) return error;
|
if (error) return error;
|
||||||
|
|
||||||
ffStrbufSetStatic(&host->name, getProductNameWithHwModel(&host->family));
|
ffStrbufSetStatic(&host->name, ffHostGetMacProductNameWithHwModel(&host->family));
|
||||||
if (host->name.length == 0)
|
if (host->name.length == 0)
|
||||||
getProductNameWithIokit(&host->name);
|
getProductNameWithIokit(&host->name);
|
||||||
if (host->name.length == 0)
|
if (host->name.length == 0)
|
||||||
|
|||||||
@@ -19,5 +19,9 @@ const char* ffDetectHost(FFHostResult* host)
|
|||||||
ffSettingsGetFreeBSDKenv("smbios.system.maker", &host->vendor);
|
ffSettingsGetFreeBSDKenv("smbios.system.maker", &host->vendor);
|
||||||
ffCleanUpSmbiosValue(&host->vendor);
|
ffCleanUpSmbiosValue(&host->vendor);
|
||||||
|
|
||||||
|
#ifdef __x86_64__
|
||||||
|
ffHostDetectMac(host);
|
||||||
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ const char* ffDetectHost(FFHostResult* host)
|
|||||||
ffStrbufSetStatic(&host->vendor, "Apple Inc.");
|
ffStrbufSetStatic(&host->vendor, "Apple Inc.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __x86_64__
|
||||||
|
ffHostDetectMac(host);
|
||||||
|
#endif
|
||||||
|
|
||||||
//KVM/Qemu virtual machine
|
//KVM/Qemu virtual machine
|
||||||
if(ffStrbufStartsWithS(&host->name, "Standard PC"))
|
if(ffStrbufStartsWithS(&host->name, "Standard PC"))
|
||||||
ffStrbufPrependS(&host->name, "KVM/QEMU ");
|
ffStrbufPrependS(&host->name, "KVM/QEMU ");
|
||||||
|
|||||||
@@ -0,0 +1,193 @@
|
|||||||
|
#include "host.h"
|
||||||
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
|
const char* ffHostGetMacProductNameWithHwModel(const FFstrbuf* hwModel)
|
||||||
|
{
|
||||||
|
// Macbook Pro: https://support.apple.com/en-us/HT201300
|
||||||
|
// Macbook Air: https://support.apple.com/en-us/HT201862
|
||||||
|
// Mac mini: https://support.apple.com/en-us/HT201894
|
||||||
|
// iMac: https://support.apple.com/en-us/HT201634
|
||||||
|
// Mac Pro: https://support.apple.com/en-us/HT202888
|
||||||
|
// Mac Studio: https://support.apple.com/en-us/HT213073
|
||||||
|
|
||||||
|
if(ffStrbufStartsWithS(hwModel, "MacBookPro"))
|
||||||
|
{
|
||||||
|
const char* version = hwModel->chars + strlen("MacBookPro");
|
||||||
|
if(ffStrEquals(version, "18,3") ||
|
||||||
|
ffStrEquals(version, "18,4")) return "MacBook Pro (14-inch, 2021)";
|
||||||
|
if(ffStrEquals(version, "18,1") ||
|
||||||
|
ffStrEquals(version, "18,2")) return "MacBook Pro (16-inch, 2021)";
|
||||||
|
if(ffStrEquals(version, "17,1")) return "MacBook Pro (13-inch, M1, 2020)";
|
||||||
|
if(ffStrEquals(version, "16,3")) return "MacBook Pro (13-inch, 2020, Two Thunderbolt 3 ports)";
|
||||||
|
if(ffStrEquals(version, "16,2")) return "MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)";
|
||||||
|
if(ffStrEquals(version, "16,4") ||
|
||||||
|
ffStrEquals(version, "16,1")) return "MacBook Pro (16-inch, 2019)";
|
||||||
|
if(ffStrEquals(version, "15,4")) return "MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports)";
|
||||||
|
if(ffStrEquals(version, "15,3")) return "MacBook Pro (15-inch, 2019)";
|
||||||
|
if(ffStrEquals(version, "15,2")) return "MacBook Pro (13-inch, 2018/2019, Four Thunderbolt 3 ports)";
|
||||||
|
if(ffStrEquals(version, "15,1")) return "MacBook Pro (15-inch, 2018/2019)";
|
||||||
|
if(ffStrEquals(version, "14,3")) return "MacBook Pro (15-inch, 2017)";
|
||||||
|
if(ffStrEquals(version, "14,2")) return "MacBook Pro (13-inch, 2017, Four Thunderbolt 3 ports)";
|
||||||
|
if(ffStrEquals(version, "14,1")) return "MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)";
|
||||||
|
if(ffStrEquals(version, "13,3")) return "MacBook Pro (15-inch, 2016)";
|
||||||
|
if(ffStrEquals(version, "13,2")) return "MacBook Pro (13-inch, 2016, Four Thunderbolt 3 ports)";
|
||||||
|
if(ffStrEquals(version, "13,1")) return "MacBook Pro (13-inch, 2016, Two Thunderbolt 3 ports)";
|
||||||
|
if(ffStrEquals(version, "12,1")) return "MacBook Pro (Retina, 13-inch, Early 2015)";
|
||||||
|
if(ffStrEquals(version, "11,4") ||
|
||||||
|
ffStrEquals(version, "11,5")) return "MacBook Pro (Retina, 15-inch, Mid 2015)";
|
||||||
|
if(ffStrEquals(version, "11,2") ||
|
||||||
|
ffStrEquals(version, "11,3")) return "MacBook Pro (Retina, 15-inch, Late 2013/Mid 2014)";
|
||||||
|
if(ffStrEquals(version, "11,1")) return "MacBook Pro (Retina, 13-inch, Late 2013/Mid 2014)";
|
||||||
|
if(ffStrEquals(version, "10,2")) return "MacBook Pro (Retina, 13-inch, Late 2012/Early 2013)";
|
||||||
|
if(ffStrEquals(version, "10,1")) return "MacBook Pro (Retina, 15-inch, Mid 2012/Early 2013)";
|
||||||
|
if(ffStrEquals(version, "9,2")) return "MacBook Pro (13-inch, Mid 2012)";
|
||||||
|
if(ffStrEquals(version, "9,1")) return "MacBook Pro (15-inch, Mid 2012)";
|
||||||
|
if(ffStrEquals(version, "8,3")) return "MacBook Pro (17-inch, 2011)";
|
||||||
|
if(ffStrEquals(version, "8,2")) return "MacBook Pro (15-inch, 2011)";
|
||||||
|
if(ffStrEquals(version, "8,1")) return "MacBook Pro (13-inch, 2011)";
|
||||||
|
if(ffStrEquals(version, "7,1")) return "MacBook Pro (13-inch, Mid 2010)";
|
||||||
|
if(ffStrEquals(version, "6,2")) return "MacBook Pro (15-inch, Mid 2010)";
|
||||||
|
if(ffStrEquals(version, "6,1")) return "MacBook Pro (17-inch, Mid 2010)";
|
||||||
|
if(ffStrEquals(version, "5,5")) return "MacBook Pro (13-inch, Mid 2009)";
|
||||||
|
if(ffStrEquals(version, "5,3")) return "MacBook Pro (15-inch, Mid 2009)";
|
||||||
|
if(ffStrEquals(version, "5,2")) return "MacBook Pro (17-inch, Mid/Early 2009)";
|
||||||
|
if(ffStrEquals(version, "5,1")) return "MacBook Pro (15-inch, Late 2008)";
|
||||||
|
if(ffStrEquals(version, "4,1")) return "MacBook Pro (17/15-inch, Early 2008)";
|
||||||
|
}
|
||||||
|
else if(ffStrbufStartsWithS(hwModel, "MacBookAir"))
|
||||||
|
{
|
||||||
|
const char* version = hwModel->chars + strlen("MacBookAir");
|
||||||
|
if(ffStrEquals(version, "10,1")) return "MacBook Air (M1, 2020)";
|
||||||
|
if(ffStrEquals(version, "9,1")) return "MacBook Air (Retina, 13-inch, 2020)";
|
||||||
|
if(ffStrEquals(version, "8,2")) return "MacBook Air (Retina, 13-inch, 2019)";
|
||||||
|
if(ffStrEquals(version, "8,1")) return "MacBook Air (Retina, 13-inch, 2018)";
|
||||||
|
if(ffStrEquals(version, "7,2")) return "MacBook Air (13-inch, Early 2015/2017)";
|
||||||
|
if(ffStrEquals(version, "7,1")) return "MacBook Air (11-inch, Early 2015)";
|
||||||
|
if(ffStrEquals(version, "6,2")) return "MacBook Air (13-inch, Mid 2013/Early 2014)";
|
||||||
|
if(ffStrEquals(version, "6,1")) return "MacBook Air (11-inch, Mid 2013/Early 2014)";
|
||||||
|
if(ffStrEquals(version, "5,2")) return "MacBook Air (13-inch, Mid 2012)";
|
||||||
|
if(ffStrEquals(version, "5,1")) return "MacBook Air (11-inch, Mid 2012)";
|
||||||
|
if(ffStrEquals(version, "4,2")) return "MacBook Air (13-inch, Mid 2011)";
|
||||||
|
if(ffStrEquals(version, "4,1")) return "MacBook Air (11-inch, Mid 2011)";
|
||||||
|
if(ffStrEquals(version, "3,2")) return "MacBook Air (13-inch, Late 2010)";
|
||||||
|
if(ffStrEquals(version, "3,1")) return "MacBook Air (11-inch, Late 2010)";
|
||||||
|
if(ffStrEquals(version, "2,1")) return "MacBook Air (Mid 2009)";
|
||||||
|
}
|
||||||
|
else if(ffStrbufStartsWithS(hwModel, "Macmini"))
|
||||||
|
{
|
||||||
|
const char* version = hwModel->chars + strlen("Macmini");
|
||||||
|
if(ffStrEquals(version, "9,1")) return "Mac mini (M1, 2020)";
|
||||||
|
if(ffStrEquals(version, "8,1")) return "Mac mini (2018)";
|
||||||
|
if(ffStrEquals(version, "7,1")) return "Mac mini (Mid 2014)";
|
||||||
|
if(ffStrEquals(version, "6,1") ||
|
||||||
|
ffStrEquals(version, "6,2")) return "Mac mini (Late 2012)";
|
||||||
|
if(ffStrEquals(version, "5,1") ||
|
||||||
|
ffStrEquals(version, "5,2")) return "Mac mini (Mid 2011)";
|
||||||
|
if(ffStrEquals(version, "4,1")) return "Mac mini (Mid 2010)";
|
||||||
|
if(ffStrEquals(version, "3,1")) return "Mac mini (Early/Late 2009)";
|
||||||
|
}
|
||||||
|
else if(ffStrbufStartsWithS(hwModel, "MacBook"))
|
||||||
|
{
|
||||||
|
const char* version = hwModel->chars + strlen("MacBook");
|
||||||
|
if(ffStrEquals(version, "10,1")) return "MacBook (Retina, 12-inch, 2017)";
|
||||||
|
if(ffStrEquals(version, "9,1")) return "MacBook (Retina, 12-inch, Early 2016)";
|
||||||
|
if(ffStrEquals(version, "8,1")) return "MacBook (Retina, 12-inch, Early 2015)";
|
||||||
|
if(ffStrEquals(version, "7,1")) return "MacBook (13-inch, Mid 2010)";
|
||||||
|
if(ffStrEquals(version, "6,1")) return "MacBook (13-inch, Late 2009)";
|
||||||
|
if(ffStrEquals(version, "5,2")) return "MacBook (13-inch, Early/Mid 2009)";
|
||||||
|
}
|
||||||
|
else if(ffStrbufStartsWithS(hwModel, "MacPro"))
|
||||||
|
{
|
||||||
|
const char* version = hwModel->chars + strlen("MacPro");
|
||||||
|
if(ffStrEquals(version, "7,1")) return "Mac Pro (2019)";
|
||||||
|
if(ffStrEquals(version, "6,1")) return "Mac Pro (Late 2013)";
|
||||||
|
if(ffStrEquals(version, "5,1")) return "Mac Pro (Mid 2010 - Mid 2012)";
|
||||||
|
if(ffStrEquals(version, "4,1")) return "Mac Pro (Early 2009)";
|
||||||
|
}
|
||||||
|
else if(ffStrbufStartsWithS(hwModel, "Mac"))
|
||||||
|
{
|
||||||
|
const char* version = hwModel->chars + strlen("Mac");
|
||||||
|
if(ffStrEquals(version, "16,3")) return "iMac (24-inch, 2024, Four Thunderbolt / USB 4 ports)";
|
||||||
|
if(ffStrEquals(version, "16,2")) return "iMac (24-inch, 2024, Two Thunderbolt / USB 4 ports)";
|
||||||
|
if(ffStrEquals(version, "16,1") ||
|
||||||
|
ffStrEquals(version, "16,6") ||
|
||||||
|
ffStrEquals(version, "16,8")) return "MacBook Pro (14-inch, 2024, Three Thunderbolt 4 ports)";
|
||||||
|
if(ffStrEquals(version, "16,7") ||
|
||||||
|
ffStrEquals(version, "16,5")) return "MacBook Pro (16-inch, 2024, Three Thunderbolt 4 ports)";
|
||||||
|
if(ffStrEquals(version, "16,15") ||
|
||||||
|
ffStrEquals(version, "16,10")) return "Mac mini (2024)";
|
||||||
|
if(ffStrEquals(version, "15,13")) return "MacBook Air (15-inch, M3, 2024)";
|
||||||
|
if(ffStrEquals(version, "15,2")) return "MacBook Air (13-inch, M3, 2024)";
|
||||||
|
if(ffStrEquals(version, "15,3")) return "MacBook Pro (14-inch, Nov 2023, Two Thunderbolt / USB 4 ports)";
|
||||||
|
if(ffStrEquals(version, "15,4")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports)";
|
||||||
|
if(ffStrEquals(version, "15,5")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports, Two USB 3 ports)";
|
||||||
|
if(ffStrEquals(version, "15,6") ||
|
||||||
|
ffStrEquals(version, "15,8") ||
|
||||||
|
ffStrEquals(version, "15,10")) return "MacBook Pro (14-inch, Nov 2023, Three Thunderbolt 4 ports)";
|
||||||
|
if(ffStrEquals(version, "15,7") ||
|
||||||
|
ffStrEquals(version, "15,9") ||
|
||||||
|
ffStrEquals(version, "15,11")) return "MacBook Pro (16-inch, Nov 2023, Three Thunderbolt 4 ports)";
|
||||||
|
if(ffStrEquals(version, "14,15")) return "MacBook Air (15-inch, M2, 2023)";
|
||||||
|
if(ffStrEquals(version, "14,14")) return "Mac Studio (M2 Ultra, 2023, Two Thunderbolt 4 front ports)";
|
||||||
|
if(ffStrEquals(version, "14,13")) return "Mac Studio (M2 Max, 2023, Two USB-C front ports)";
|
||||||
|
if(ffStrEquals(version, "14,8")) return "Mac Pro (2023)";
|
||||||
|
if(ffStrEquals(version, "14,6") ||
|
||||||
|
ffStrEquals(version, "14,10")) return "MacBook Pro (16-inch, 2023)";
|
||||||
|
if(ffStrEquals(version, "14,5") ||
|
||||||
|
ffStrEquals(version, "14,9")) return "MacBook Pro (14-inch, 2023)";
|
||||||
|
if(ffStrEquals(version, "14,3")) return "Mac mini (M2, 2023, Two Thunderbolt 4 ports)";
|
||||||
|
if(ffStrEquals(version, "14,12")) return "Mac mini (M2, 2023, Four Thunderbolt 4 ports)";
|
||||||
|
if(ffStrEquals(version, "14,7")) return "MacBook Pro (13-inch, M2, 2022)";
|
||||||
|
if(ffStrEquals(version, "14,2")) return "MacBook Air (M2, 2022)";
|
||||||
|
if(ffStrEquals(version, "13,1")) return "Mac Studio (M1 Max, 2022, Two USB-C front ports)";
|
||||||
|
if(ffStrEquals(version, "13,2")) return "Mac Studio (M1 Ultra, 2022, Two Thunderbolt 4 front ports)";
|
||||||
|
}
|
||||||
|
else if(ffStrbufStartsWithS(hwModel, "iMac"))
|
||||||
|
{
|
||||||
|
const char* version = hwModel->chars + strlen("iMac");
|
||||||
|
if(ffStrEquals(version, "21,1")) return "iMac (24-inch, M1, 2021, Two Thunderbolt / USB 4 ports, Two USB 3 ports)";
|
||||||
|
if(ffStrEquals(version, "21,2")) return "iMac (24-inch, M1, 2021, Two Thunderbolt / USB 4 ports)";
|
||||||
|
if(ffStrEquals(version, "20,1") ||
|
||||||
|
ffStrEquals(version, "20,2")) return "iMac (Retina 5K, 27-inch, 2020)";
|
||||||
|
if(ffStrEquals(version, "19,1")) return "iMac (Retina 5K, 27-inch, 2019)";
|
||||||
|
if(ffStrEquals(version, "19,2")) return "iMac (Retina 4K, 21.5-inch, 2019)";
|
||||||
|
if(ffStrEquals(version, "Pro1,1")) return "iMac Pro (2017)";
|
||||||
|
if(ffStrEquals(version, "18,3")) return "iMac (Retina 5K, 27-inch, 2017)";
|
||||||
|
if(ffStrEquals(version, "18,2")) return "iMac (Retina 4K, 21.5-inch, 2017)";
|
||||||
|
if(ffStrEquals(version, "18,1")) return "iMac (21.5-inch, 2017)";
|
||||||
|
if(ffStrEquals(version, "17,1")) return "iMac (Retina 5K, 27-inch, Late 2015)";
|
||||||
|
if(ffStrEquals(version, "16,2")) return "iMac (Retina 4K, 21.5-inch, Late 2015)";
|
||||||
|
if(ffStrEquals(version, "16,1")) return "iMac (21.5-inch, Late 2015)";
|
||||||
|
if(ffStrEquals(version, "15,1")) return "iMac (Retina 5K, 27-inch, Late 2014 - Mid 2015)";
|
||||||
|
if(ffStrEquals(version, "14,4")) return "iMac (21.5-inch, Mid 2014)";
|
||||||
|
if(ffStrEquals(version, "14,2")) return "iMac (27-inch, Late 2013)";
|
||||||
|
if(ffStrEquals(version, "14,1")) return "iMac (21.5-inch, Late 2013)";
|
||||||
|
if(ffStrEquals(version, "13,2")) return "iMac (27-inch, Late 2012)";
|
||||||
|
if(ffStrEquals(version, "13,1")) return "iMac (21.5-inch, Late 2012)";
|
||||||
|
if(ffStrEquals(version, "12,2")) return "iMac (27-inch, Mid 2011)";
|
||||||
|
if(ffStrEquals(version, "12,1")) return "iMac (21.5-inch, Mid 2011)";
|
||||||
|
if(ffStrEquals(version, "11,3")) return "iMac (27-inch, Mid 2010)";
|
||||||
|
if(ffStrEquals(version, "11,2")) return "iMac (21.5-inch, Mid 2010)";
|
||||||
|
if(ffStrEquals(version, "10,1")) return "iMac (27/21.5-inch, Late 2009)";
|
||||||
|
if(ffStrEquals(version, "9,1")) return "iMac (24/20-inch, Early 2009)";
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __x86_64__
|
||||||
|
bool ffHostDetectMac(FFHostResult* host)
|
||||||
|
{
|
||||||
|
if (ffStrbufEqualS(&host->family, "Mac") && ffStrbufEqualS(&host->vendor, "Apple Inc."))
|
||||||
|
{
|
||||||
|
const char* productName = ffHostGetMacProductNameWithHwModel(&host->name);
|
||||||
|
if (productName)
|
||||||
|
{
|
||||||
|
ffStrbufDestroy(&host->family);
|
||||||
|
ffStrbufInitMove(&host->family, &host->name);
|
||||||
|
ffStrbufSetStatic(&host->name, productName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -72,5 +72,9 @@ const char* ffDetectHost(FFHostResult* host)
|
|||||||
ffCleanUpSmbiosValue(&host->family);
|
ffCleanUpSmbiosValue(&host->family);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _WIN32 && __x86_64__
|
||||||
|
ffHostDetectMac(host);
|
||||||
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
|
#include "common/io/io.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -140,6 +141,8 @@ static const char* detectByGlx(FFOpenGLResult* result)
|
|||||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(glx, data, XCloseDisplay);
|
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(glx, data, XCloseDisplay);
|
||||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(glx, data, XFree);
|
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(glx, data, XFree);
|
||||||
|
|
||||||
|
FF_SUPPRESS_IO();
|
||||||
|
|
||||||
return glxHandleData(result, &data);
|
return glxHandleData(result, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ void ffOpenGLHandleResult(FFOpenGLResult* result, __typeof__(&glGetString) ffglG
|
|||||||
#if defined(FF_HAVE_EGL) || __has_include(<EGL/egl.h>)
|
#if defined(FF_HAVE_EGL) || __has_include(<EGL/egl.h>)
|
||||||
#include "common/io/io.h"
|
#include "common/io/io.h"
|
||||||
|
|
||||||
|
#define EGL_EGL_PROTOTYPES 1
|
||||||
|
#define EGL_EGLEXT_PROTOTYPES 1
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
|
#include <EGL/eglext.h>
|
||||||
|
|
||||||
typedef struct EGLData
|
typedef struct EGLData
|
||||||
{
|
{
|
||||||
@@ -102,9 +105,20 @@ static const char* eglHandleData(FFOpenGLResult* result, EGLData* data)
|
|||||||
if(!data->ffglGetString)
|
if(!data->ffglGetString)
|
||||||
return "eglGetProcAddress(glGetString) returned NULL";
|
return "eglGetProcAddress(glGetString) returned NULL";
|
||||||
|
|
||||||
data->display = data->ffeglGetDisplay(EGL_DEFAULT_DISPLAY);
|
#if EGL_VERSION_1_5
|
||||||
if(data->display == EGL_NO_DISPLAY)
|
PFNEGLGETPLATFORMDISPLAYEXTPROC ffeglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYEXTPROC) data->ffeglGetProcAddress("eglGetPlatformDisplay");
|
||||||
return "eglGetDisplay returned EGL_NO_DISPLAY";
|
if (ffeglGetPlatformDisplay)
|
||||||
|
data->display = ffeglGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, NULL, NULL);
|
||||||
|
|
||||||
|
if(!ffeglGetPlatformDisplay || data->display == EGL_NO_DISPLAY)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
data->display = data->ffeglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
|
if(data->display == EGL_NO_DISPLAY)
|
||||||
|
return "eglGetDisplay returned EGL_NO_DISPLAY";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EGLint major, minor;
|
EGLint major, minor;
|
||||||
if(data->ffeglInitialize(data->display, &major, &minor) == EGL_FALSE)
|
if(data->ffeglInitialize(data->display, &major, &minor) == EGL_FALSE)
|
||||||
|
|||||||
@@ -52,6 +52,15 @@ FF_MAYBE_UNUSED static void getUbuntuFlavour(FFOSResult* result)
|
|||||||
if(!ffStrSet(xdgConfigDirs))
|
if(!ffStrSet(xdgConfigDirs))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(ffStrbufStartsWithS(&result->prettyName, "Linux Lite "))
|
||||||
|
{
|
||||||
|
ffStrbufSetS(&result->name, "Linux Lite");
|
||||||
|
ffStrbufSetS(&result->id, "linuxlite");
|
||||||
|
ffStrbufSetS(&result->idLike, "ubuntu");
|
||||||
|
ffStrbufSetS(&result->versionID, result->prettyName.chars + strlen("Linux Lite "));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(ffStrContains(xdgConfigDirs, "kde") || ffStrContains(xdgConfigDirs, "plasma") || ffStrContains(xdgConfigDirs, "kubuntu"))
|
if(ffStrContains(xdgConfigDirs, "kde") || ffStrContains(xdgConfigDirs, "plasma") || ffStrContains(xdgConfigDirs, "kubuntu"))
|
||||||
{
|
{
|
||||||
ffStrbufSetS(&result->name, "Kubuntu");
|
ffStrbufSetS(&result->name, "Kubuntu");
|
||||||
@@ -166,6 +175,17 @@ FF_MAYBE_UNUSED static bool detectDebianDerived(FFOSResult* result)
|
|||||||
ffStrbufSetNS(&result->versionID, versionEnd - versionStart, result->prettyName.chars + versionStart);
|
ffStrbufSetNS(&result->versionID, versionEnd - versionStart, result->prettyName.chars + versionStart);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (ffStrbufStartsWithS(&result->prettyName, "Armbian-unofficial ")) // Unofficial Armbian image built from source
|
||||||
|
{
|
||||||
|
ffStrbufSetS(&result->name, "Armbian (custom build)");
|
||||||
|
ffStrbufSetS(&result->id, "armbian");
|
||||||
|
ffStrbufSetS(&result->idLike, "debian");
|
||||||
|
ffStrbufClear(&result->versionID);
|
||||||
|
uint32_t versionStart = ffStrbufFirstIndexC(&result->prettyName, ' ') + 1;
|
||||||
|
uint32_t versionEnd = ffStrbufNextIndexC(&result->prettyName, versionStart, ' ');
|
||||||
|
ffStrbufSetNS(&result->versionID, versionEnd - versionStart, result->prettyName.chars + versionStart);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (ffStrbufStartsWithS(&result->name, "Loc-OS"))
|
else if (ffStrbufStartsWithS(&result->name, "Loc-OS"))
|
||||||
{
|
{
|
||||||
ffStrbufSetS(&result->id, "locos");
|
ffStrbufSetS(&result->id, "locos");
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
|
|||||||
if (!(options->disabled & FF_PACKAGES_FLAG_PKG_BIT))
|
if (!(options->disabled & FF_PACKAGES_FLAG_PKG_BIT))
|
||||||
{
|
{
|
||||||
result->pkg = getNumElementsImpl(FASTFETCH_TARGET_DIR_ROOT
|
result->pkg = getNumElementsImpl(FASTFETCH_TARGET_DIR_ROOT
|
||||||
#if __OpenBSD
|
#if __OpenBSD__
|
||||||
"/var/db/pkg"
|
"/var/db/pkg"
|
||||||
#else
|
#else
|
||||||
"/usr/pkg/pkgdb"
|
"/usr/pkg/pkgdb"
|
||||||
|
|||||||
@@ -37,9 +37,14 @@ const char* ffDetectWifi(FFlist* result)
|
|||||||
item->conn.channel = 0;
|
item->conn.channel = 0;
|
||||||
item->conn.frequency = 0;
|
item->conn.frequency = 0;
|
||||||
|
|
||||||
|
ffParsePropLines(ifconfig.chars, "status: ", &item->conn.status);
|
||||||
|
if (!ffStrbufEqualS(&item->conn.status, "associated"))
|
||||||
|
continue;
|
||||||
|
|
||||||
ffParsePropLines(ifconfig.chars, "ssid ", &item->conn.ssid);
|
ffParsePropLines(ifconfig.chars, "ssid ", &item->conn.ssid);
|
||||||
if (item->conn.ssid.length)
|
if (item->conn.ssid.length)
|
||||||
{
|
{
|
||||||
|
// This doesn't work for quoted SSID values
|
||||||
uint32_t idx = ffStrbufFirstIndexS(&item->conn.ssid, " bssid ");
|
uint32_t idx = ffStrbufFirstIndexS(&item->conn.ssid, " bssid ");
|
||||||
if (idx < item->conn.ssid.length)
|
if (idx < item->conn.ssid.length)
|
||||||
{
|
{
|
||||||
@@ -69,8 +74,6 @@ const char* ffDetectWifi(FFlist* result)
|
|||||||
ffStrbufPrependS(&item->conn.protocol, "802.");
|
ffStrbufPrependS(&item->conn.protocol, "802.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ffParsePropLines(ifconfig.chars, "status: ", &item->conn.status);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ static const char* detectWifiWithIoctls(FFWifiResult* item)
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < 6; ++i)
|
for(int i = 0; i < 6; ++i)
|
||||||
ffStrbufAppendF(&item->conn.bssid, "%.2X:", (uint8_t) iwr.u.ap_addr.sa_data[i]);
|
ffStrbufAppendF(&item->conn.bssid, "%.2X:", (uint8_t) iwr.u.ap_addr.sa_data[i]);
|
||||||
ffStrbufTrimRight(&item->conn.bssid, '-');
|
ffStrbufTrimRight(&item->conn.bssid, ':');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ioctl(sock, SIOCGIWRATE, &iwr) >= 0)
|
if(ioctl(sock, SIOCGIWRATE, &iwr) >= 0)
|
||||||
|
|||||||
+54
-2
@@ -2,6 +2,7 @@
|
|||||||
#include "common/commandoption.h"
|
#include "common/commandoption.h"
|
||||||
#include "common/io/io.h"
|
#include "common/io/io.h"
|
||||||
#include "common/jsonconfig.h"
|
#include "common/jsonconfig.h"
|
||||||
|
#include "common/printing.h"
|
||||||
#include "detection/version/version.h"
|
#include "detection/version/version.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
#include "util/mallocHelper.h"
|
#include "util/mallocHelper.h"
|
||||||
@@ -15,16 +16,65 @@
|
|||||||
#include "util/windows/getline.h"
|
#include "util/windows/getline.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void printCommandFormatHelpJson(void)
|
||||||
|
{
|
||||||
|
yyjson_mut_doc* doc = yyjson_mut_doc_new(NULL);
|
||||||
|
yyjson_mut_val* root = yyjson_mut_obj(doc);
|
||||||
|
yyjson_mut_doc_set_root(doc, root);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i <= 'Z' - 'A'; ++i)
|
||||||
|
{
|
||||||
|
for (FFModuleBaseInfo** modules = ffModuleInfos[i]; *modules; ++modules)
|
||||||
|
{
|
||||||
|
FFModuleBaseInfo* baseInfo = *modules;
|
||||||
|
if (!baseInfo->formatArgs.count) continue;
|
||||||
|
|
||||||
|
FF_STRBUF_AUTO_DESTROY type = ffStrbufCreateS(baseInfo->name);
|
||||||
|
ffStrbufLowerCase(&type);
|
||||||
|
ffStrbufAppendS(&type, "Format");
|
||||||
|
|
||||||
|
yyjson_mut_val* obj = yyjson_mut_obj(doc);
|
||||||
|
if (yyjson_mut_obj_add(root, yyjson_mut_strbuf(doc, &type), obj))
|
||||||
|
{
|
||||||
|
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreateF("Output format of the module `%s`. See `-h format` for formatting syntax\n", baseInfo->name);
|
||||||
|
for (unsigned i = 0; i < baseInfo->formatArgs.count; i++)
|
||||||
|
{
|
||||||
|
const FFModuleFormatArg* arg = &baseInfo->formatArgs.args[i];
|
||||||
|
ffStrbufAppendF(&content, " %u. {%s}: %s\n", i + 1, arg->name, arg->desc);
|
||||||
|
}
|
||||||
|
ffStrbufTrimRight(&content, '\n');
|
||||||
|
yyjson_mut_obj_add_strbuf(doc, obj, "description", &content);
|
||||||
|
yyjson_mut_obj_add_str(doc, obj, "type", "string");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
yyjson_mut_write_fp(stdout, doc, YYJSON_WRITE_PRETTY, NULL, NULL);
|
||||||
|
putchar('\n');
|
||||||
|
yyjson_mut_doc_free(doc);
|
||||||
|
}
|
||||||
|
|
||||||
static void printCommandFormatHelp(const char* command)
|
static void printCommandFormatHelp(const char* command)
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY type = ffStrbufCreateNS((uint32_t) (strlen(command) - strlen("-format")), command);
|
FF_STRBUF_AUTO_DESTROY type = ffStrbufCreateNS((uint32_t) (strlen(command) - strlen("-format")), command);
|
||||||
|
ffStrbufLowerCase(&type);
|
||||||
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(command[0]) - 'A']; *modules; ++modules)
|
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(command[0]) - 'A']; *modules; ++modules)
|
||||||
{
|
{
|
||||||
FFModuleBaseInfo* baseInfo = *modules;
|
FFModuleBaseInfo* baseInfo = *modules;
|
||||||
if (ffStrbufIgnCaseEqualS(&type, baseInfo->name))
|
if (ffStrbufIgnCaseEqualS(&type, baseInfo->name))
|
||||||
{
|
{
|
||||||
if (baseInfo->printHelpFormat)
|
if (baseInfo->formatArgs.count > 0)
|
||||||
baseInfo->printHelpFormat();
|
{
|
||||||
|
printf("--%s-format:\n", type.chars);
|
||||||
|
printf("Sets the format string for %s output.\n", baseInfo->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 < baseInfo->formatArgs.count; i++)
|
||||||
|
{
|
||||||
|
const FFModuleFormatArg* arg = &baseInfo->formatArgs.args[i];
|
||||||
|
printf("%16s {%u}: %s\n", arg->name, i + 1, arg->desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Error: Module '%s' doesn't support output formatting\n", baseInfo->name);
|
fprintf(stderr, "Error: Module '%s' doesn't support output formatting\n", baseInfo->name);
|
||||||
return;
|
return;
|
||||||
@@ -252,6 +302,8 @@ static void printCommandHelp(const char* command)
|
|||||||
puts(FASTFETCH_DATATEXT_HELP_COLOR);
|
puts(FASTFETCH_DATATEXT_HELP_COLOR);
|
||||||
else if(ffStrEqualsIgnCase(command, "format"))
|
else if(ffStrEqualsIgnCase(command, "format"))
|
||||||
puts(FASTFETCH_DATATEXT_HELP_FORMAT);
|
puts(FASTFETCH_DATATEXT_HELP_FORMAT);
|
||||||
|
else if(ffStrEqualsIgnCase(command, "format-json"))
|
||||||
|
printCommandFormatHelpJson();
|
||||||
else if(ffCharIsEnglishAlphabet(command[0]) && ffStrEndsWithIgnCase(command, "-format")) // <module>-format
|
else if(ffCharIsEnglishAlphabet(command[0]) && ffStrEndsWithIgnCase(command, "-format")) // <module>-format
|
||||||
printCommandFormatHelp(command);
|
printCommandFormatHelp(command);
|
||||||
else if(!printSpecificCommandHelp(command))
|
else if(!printSpecificCommandHelp(command))
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
$2_,met$$$$$$$$$$gg.
|
$2_,met$$$$$$$$$$gg.
|
||||||
,g$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$P.
|
,g$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$P.
|
||||||
,g$$$$P" """Y$$$$.".
|
,g$$$$P"" """Y$$$$.".
|
||||||
,$$$$P' `$$$$$$.
|
,$$$$P' `$$$$$$.
|
||||||
',$$$$P ,ggs. `$$$$b:
|
',$$$$P ,ggs. `$$$$b:
|
||||||
`d$$$$' ,$P"' $1.$2 $$$$$$
|
`d$$$$' ,$P"' $1.$2 $$$$$$
|
||||||
$$$$P d$' $1,$2 $$$$$$P
|
$$$$P d$' $1,$2 $$$$P
|
||||||
$$$$: $$. $1-$2 ,d$$$$'
|
$$$$: $$$. $1-$2 ,d$$$$'
|
||||||
$$$$; Y$b._ _,d$P'
|
$$$$; Y$b._ _,d$P'
|
||||||
Y$$$$. $1`.$2`"Y$$$$$$$$P"'
|
Y$$$$. $1`.$2`"Y$$$$$$$$P"'
|
||||||
`$$$$b $1"-.__
|
`$$$$b $1"-.__
|
||||||
$2`Y$$$$
|
$2`Y$$$$b
|
||||||
`Y$$$$.
|
`Y$$$$.
|
||||||
`$$$$b.
|
`$$$$b.
|
||||||
`Y$$$$b.
|
`Y$$$$b.
|
||||||
`"Y$$b._
|
`"Y$$b._
|
||||||
`"""
|
`""""
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
,xXc
|
,xXc
|
||||||
.l0MMMMMO
|
.l0MMMMMO
|
||||||
.kNMMMMMWMMMN,
|
.kNMMMMM$2W$1MMMN,
|
||||||
KMMMMMMKMMMMMMo
|
KMMMMMM$2K$1MMMMMMo
|
||||||
'MMMMMMNKMMMMMM:
|
'MMMMMMN$2K$1MMMMMM:
|
||||||
kMMMMMMOMMMMMMO
|
kMMMMMM$2O$1MMMMMMO
|
||||||
.MMMMMMX0MMMMMW.
|
.MMMMMM$20$1XMMMMMW.
|
||||||
oMMMMMMxWMMMMM:
|
oMMMMM$2x$1MMMMMMM:
|
||||||
WMMMMMNkMMMMMO
|
WMMMMM$2x$1MMMMMMO
|
||||||
:MMMMMMOXMMMMW
|
:MMMMMM$2O$1XMMMMW
|
||||||
.0MMMMMxMMMMM;
|
.0MMMMM$2x$1MMMMM;
|
||||||
:;cKMMWxMMMMO
|
:;cKMMW$2x$1MMMMO
|
||||||
'MMWMMXOMMMMl
|
'MMWMMX$2O$1MMMMl
|
||||||
kMMMMKOMMMMMX:
|
kMMMMK$2O$1MMMMMX:
|
||||||
.WMMMMKOWMMM0c
|
.WMMMMK$2O$1WMMM0c
|
||||||
lMMMMMWO0MNd:'
|
lMMMMMW$2O$1WMNd:'
|
||||||
oollXMKXoxl;.
|
oollXMK$2o$1Xxl;.
|
||||||
':. .: .'
|
':. .:$2 .$1'
|
||||||
..
|
$2..
|
||||||
.
|
.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
${c1} /\\
|
/\\
|
||||||
/ \\
|
/ \\
|
||||||
/ ${c2}/ ${c1}/
|
/ ${c2}/ ${c1}/
|
||||||
> ${c2}/ ${c1}/
|
> ${c2}/ ${c1}/
|
||||||
\\ ${c2}\\ ${c1}\\
|
\\ ${c2}\\ ${c1}\\
|
||||||
\\_${c2}\\${c1}_\\
|
\\_${c2}\\${c1}_\\
|
||||||
${c2} \\
|
${c2} \\
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
,dKNWWNKOxo;.
|
||||||
|
;xKXOdoloOWMWX0d:.
|
||||||
|
.dNNd' cNMMMMNKOx;.
|
||||||
|
.dWNo .:oxO000KXKl.
|
||||||
|
.OMNl .....
|
||||||
|
oNMXd,.
|
||||||
|
.lKWMNKkdollccc:::;;;,'..
|
||||||
|
.;ox0KNWWMMMMMMMMWWWWNK0xl,.
|
||||||
|
..,;:ccloodxO0KNWMMMMNOc.
|
||||||
|
.';lxKWMMWk'
|
||||||
|
..,:ccc:,. .oXMMMO
|
||||||
|
.:d0NWWWWWMWXOo,. .,cc:;,,'..oWMMW
|
||||||
|
.c0WW0xl:;,;cd0NMNO:'..ldl;. .'.:XMMM
|
||||||
|
xWMKc. .;OWMWX0xl. .dWMMK
|
||||||
|
WMWd. .oKWMMXx, .dNMMXc
|
||||||
|
NMMK:. ..:oxo:oOXMMNOdc:;;cxKWMWO;
|
||||||
|
;kXWN0xooodkOOko;. .lONMMMMWWMMWKx;.
|
||||||
|
,okKXXXKOxc'. .:kKWMMWXOl'
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@*=+*%@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@: :#@@@@@@@@@@
|
||||||
|
@@@@@@@@@# -#@@@@@@@@
|
||||||
|
@@%###*=. :=*#@@@@
|
||||||
|
@@= =@@
|
||||||
|
@@= -@@
|
||||||
|
@@*: :*@@
|
||||||
|
@%*=: :=*@@
|
||||||
|
@@@%%##%%@@@
|
||||||
+21
-4
@@ -2477,10 +2477,10 @@ static const FFlogo L[] = {
|
|||||||
.names = {"LinuxLite", "Linux Lite", "linux_lite"},
|
.names = {"LinuxLite", "Linux Lite", "linux_lite"},
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_LINUXLITE,
|
.lines = FASTFETCH_DATATEXT_LOGO_LINUXLITE,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_YELLOW,
|
FF_COLOR_FG_GREEN,
|
||||||
FF_COLOR_FG_WHITE,
|
FF_COLOR_FG_WHITE,
|
||||||
},
|
},
|
||||||
.colorKeys = FF_COLOR_FG_YELLOW,
|
.colorKeys = FF_COLOR_FG_GREEN,
|
||||||
.colorTitle = FF_COLOR_FG_WHITE,
|
.colorTitle = FF_COLOR_FG_WHITE,
|
||||||
},
|
},
|
||||||
// LinuxLightSmall
|
// LinuxLightSmall
|
||||||
@@ -2489,10 +2489,10 @@ static const FFlogo L[] = {
|
|||||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_LINUXLITE_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_LINUXLITE_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_YELLOW,
|
FF_COLOR_FG_BLUE,
|
||||||
FF_COLOR_FG_WHITE,
|
FF_COLOR_FG_WHITE,
|
||||||
},
|
},
|
||||||
.colorKeys = FF_COLOR_FG_YELLOW,
|
.colorKeys = FF_COLOR_FG_BLUE,
|
||||||
.colorTitle = FF_COLOR_FG_WHITE,
|
.colorTitle = FF_COLOR_FG_WHITE,
|
||||||
},
|
},
|
||||||
// LinuxMint
|
// LinuxMint
|
||||||
@@ -4052,6 +4052,14 @@ static const FFlogo S[] = {
|
|||||||
FF_COLOR_FG_RED,
|
FF_COLOR_FG_RED,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// Serpent OS
|
||||||
|
{
|
||||||
|
.names = {"Serpent OS"},
|
||||||
|
.lines = FASTFETCH_DATATEXT_LOGO_SERPENT_OS,
|
||||||
|
.colors = {
|
||||||
|
FF_COLOR_FG_WHITE,
|
||||||
|
},
|
||||||
|
},
|
||||||
// Semc
|
// Semc
|
||||||
{
|
{
|
||||||
.names = {"semc"},
|
.names = {"semc"},
|
||||||
@@ -4627,6 +4635,15 @@ static const FFlogo U[] = {
|
|||||||
FF_COLOR_FG_WHITE,
|
FF_COLOR_FG_WHITE,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// Ultramarine Small
|
||||||
|
{
|
||||||
|
.names = {"Ultramarine_small"},
|
||||||
|
.lines = FASTFETCH_DATATEXT_LOGO_ULTRAMARINE_SMALL,
|
||||||
|
.colors = {
|
||||||
|
FF_COLOR_FG_BLUE,
|
||||||
|
FF_COLOR_FG_WHITE,
|
||||||
|
},
|
||||||
|
},
|
||||||
// Unifi
|
// Unifi
|
||||||
{
|
{
|
||||||
.names = {"Unifi"},
|
.names = {"Unifi"},
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
#include "modules/battery/battery.h"
|
#include "modules/battery/battery.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_BATTERY_NUM_FORMAT_ARGS 14
|
|
||||||
|
|
||||||
static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uint8_t index)
|
static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uint8_t index)
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||||
@@ -22,7 +20,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ffStrbufClear(&key);
|
ffStrbufClear(&key);
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 2, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(result->modelName, "name"),
|
FF_FORMAT_ARG(result->modelName, "name"),
|
||||||
}));
|
}));
|
||||||
@@ -105,7 +103,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin
|
|||||||
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
||||||
ffTempsAppendNum(result->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
ffTempsAppendNum(result->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BATTERY_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result->manufacturer, "manufacturer"),
|
FF_FORMAT_ARG(result->manufacturer, "manufacturer"),
|
||||||
FF_FORMAT_ARG(result->modelName, "model-name"),
|
FF_FORMAT_ARG(result->modelName, "model-name"),
|
||||||
FF_FORMAT_ARG(result->technology, "technology"),
|
FF_FORMAT_ARG(result->technology, "technology"),
|
||||||
@@ -270,39 +268,35 @@ void ffGenerateBatteryJsonResult(FFBatteryOptions* options, yyjson_mut_doc* doc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintBatteryHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_BATTERY_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BATTERY_MODULE_NAME, "{4} ({12} hours {13} mins) [{5}]", FF_BATTERY_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print battery capacity, status, etc",
|
||||||
"Battery manufacturer - manufacturer",
|
.parseCommandOptions = (void*) ffParseBatteryCommandOptions,
|
||||||
"Battery model name - model-name",
|
.parseJsonObject = (void*) ffParseBatteryJsonObject,
|
||||||
"Battery technology - technology",
|
.printModule = (void*) ffPrintBattery,
|
||||||
"Battery capacity (percentage num) - capacity",
|
.generateJsonResult = (void*) ffGenerateBatteryJsonResult,
|
||||||
"Battery status - status",
|
.generateJsonConfig = (void*) ffGenerateBatteryJsonConfig,
|
||||||
"Battery temperature (formatted) - temperature",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Battery cycle count - cycle-count",
|
{"Battery manufacturer", "manufacturer"},
|
||||||
"Battery serial number - serial",
|
{"Battery model name", "model-name"},
|
||||||
"Battery manufactor date - manufacture-date",
|
{"Battery technology", "technology"},
|
||||||
"Battery capacity (percentage bar) - capacity-bar",
|
{"Battery capacity (percentage num)", "capacity"},
|
||||||
"Battery time remaining days - time-days",
|
{"Battery status", "status"},
|
||||||
"Battery time remaining hours - time-hours",
|
{"Battery temperature (formatted)", "temperature"},
|
||||||
"Battery time remaining minutes - time-minutes",
|
{"Battery cycle count", "cycle-count"},
|
||||||
"Battery time remaining seconds - time-seconds",
|
{"Battery serial number", "serial"},
|
||||||
}));
|
{"Battery manufactor date", "manufacture-date"},
|
||||||
}
|
{"Battery capacity (percentage bar)", "capacity-bar"},
|
||||||
|
{"Battery time remaining days", "time-days"},
|
||||||
|
{"Battery time remaining hours", "time-hours"},
|
||||||
|
{"Battery time remaining minutes", "time-minutes"},
|
||||||
|
{"Battery time remaining seconds", "time-seconds"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBatteryOptions(FFBatteryOptions* options)
|
void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BATTERY_MODULE_NAME,
|
|
||||||
"Print battery capacity, status, etc",
|
|
||||||
ffParseBatteryCommandOptions,
|
|
||||||
ffParseBatteryJsonObject,
|
|
||||||
ffPrintBattery,
|
|
||||||
ffGenerateBatteryJsonResult,
|
|
||||||
ffPrintBatteryHelpFormat,
|
|
||||||
ffGenerateBatteryJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->temp = false;
|
options->temp = false;
|
||||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||||
|
|||||||
+19
-25
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/bios/bios.h"
|
#include "modules/bios/bios.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_BIOS_NUM_FORMAT_ARGS 5
|
|
||||||
|
|
||||||
void ffPrintBios(FFBiosOptions* options)
|
void ffPrintBios(FFBiosOptions* options)
|
||||||
{
|
{
|
||||||
FFBiosResult bios;
|
FFBiosResult bios;
|
||||||
@@ -43,7 +41,7 @@ void ffPrintBios(FFBiosOptions* options)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ffStrbufClear(&key);
|
ffStrbufClear(&key);
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 2, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(bios.type, "type"),
|
FF_FORMAT_ARG(bios.type, "type"),
|
||||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||||
}));
|
}));
|
||||||
@@ -60,7 +58,7 @@ void ffPrintBios(FFBiosOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BIOS_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(bios.date, "date"),
|
FF_FORMAT_ARG(bios.date, "date"),
|
||||||
FF_FORMAT_ARG(bios.release, "release"),
|
FF_FORMAT_ARG(bios.release, "release"),
|
||||||
FF_FORMAT_ARG(bios.vendor, "vendor"),
|
FF_FORMAT_ARG(bios.vendor, "vendor"),
|
||||||
@@ -144,30 +142,26 @@ exit:
|
|||||||
ffStrbufDestroy(&bios.type);
|
ffStrbufDestroy(&bios.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintBiosHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_BIOS_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BIOS_MODULE_NAME, "{4} ({2})", FF_BIOS_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print information of 1st-stage bootloader (name, version, release date, etc)",
|
||||||
"bios date - date",
|
.parseCommandOptions = (void*) ffParseBiosCommandOptions,
|
||||||
"bios release - release",
|
.parseJsonObject = (void*) ffParseBiosJsonObject,
|
||||||
"bios vendor - vendor",
|
.printModule = (void*) ffPrintBios,
|
||||||
"bios version - version",
|
.generateJsonResult = (void*) ffGenerateBiosJsonResult,
|
||||||
"firmware type - type",
|
.generateJsonConfig = (void*) ffGenerateBiosJsonConfig,
|
||||||
}));
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}
|
{"Bios date", "date"},
|
||||||
|
{"Bios release", "release"},
|
||||||
|
{"Bios vendor", "vendor"},
|
||||||
|
{"Bios version", "version"},
|
||||||
|
{"Firmware type", "type"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBiosOptions(FFBiosOptions* options)
|
void ffInitBiosOptions(FFBiosOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BIOS_MODULE_NAME,
|
|
||||||
"Print information of 1st-stage bootloader (name, version, release date, etc)",
|
|
||||||
ffParseBiosCommandOptions,
|
|
||||||
ffParseBiosJsonObject,
|
|
||||||
ffPrintBios,
|
|
||||||
ffGenerateBiosJsonResult,
|
|
||||||
ffPrintBiosHelpFormat,
|
|
||||||
ffGenerateBiosJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/bluetooth/bluetooth.h"
|
#include "modules/bluetooth/bluetooth.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_BLUETOOTH_NUM_FORMAT_ARGS 6
|
|
||||||
|
|
||||||
static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* device, uint8_t index)
|
static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* device, uint8_t index)
|
||||||
{
|
{
|
||||||
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
||||||
@@ -47,7 +45,7 @@ static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* de
|
|||||||
if(percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
if(percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||||
ffPercentAppendBar(&percentageBar, device->battery, options->percent, &options->moduleArgs);
|
ffPercentAppendBar(&percentageBar, device->battery, options->percent, &options->moduleArgs);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_BLUETOOTH_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BLUETOOTH_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_BLUETOOTH_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(device->name, "name"),
|
FF_FORMAT_ARG(device->name, "name"),
|
||||||
FF_FORMAT_ARG(device->address, "address"),
|
FF_FORMAT_ARG(device->address, "address"),
|
||||||
FF_FORMAT_ARG(device->type, "type"),
|
FF_FORMAT_ARG(device->type, "type"),
|
||||||
@@ -188,31 +186,27 @@ void ffGenerateBluetoothJsonResult(FF_MAYBE_UNUSED FFBluetoothOptions* options,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintBluetoothHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_BLUETOOTH_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BLUETOOTH_MODULE_NAME, "{1} ({4})", FF_BLUETOOTH_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "List (connected) bluetooth devices",
|
||||||
"Name - device name",
|
.parseCommandOptions = (void*) ffParseBluetoothCommandOptions,
|
||||||
"Address - remote device address",
|
.parseJsonObject = (void*) ffParseBluetoothJsonObject,
|
||||||
"Type - type",
|
.printModule = (void*) ffPrintBluetooth,
|
||||||
"Battery percentage number - battery-percentage",
|
.generateJsonResult = (void*) ffGenerateBluetoothJsonResult,
|
||||||
"Is connected - connected",
|
.generateJsonConfig = (void*) ffGenerateBluetoothJsonConfig,
|
||||||
"Battery percentage bar - battery-percentage-bar",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}));
|
{"Name", "name"},
|
||||||
}
|
{"Address", "address"},
|
||||||
|
{"Type", "type"},
|
||||||
|
{"Battery percentage number", "battery-percentage"},
|
||||||
|
{"Is connected", "connected"},
|
||||||
|
{"Battery percentage bar", "battery-percentage-bar"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BLUETOOTH_MODULE_NAME,
|
|
||||||
"List (connected) bluetooth devices",
|
|
||||||
ffParseBluetoothCommandOptions,
|
|
||||||
ffParseBluetoothJsonObject,
|
|
||||||
ffPrintBluetooth,
|
|
||||||
ffGenerateBluetoothJsonResult,
|
|
||||||
ffPrintBluetoothHelpFormat,
|
|
||||||
ffGenerateBluetoothJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->showDisconnected = false;
|
options->showDisconnected = false;
|
||||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "modules/bluetoothradio/bluetoothradio.h"
|
#include "modules/bluetoothradio/bluetoothradio.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_BLUETOOTHRADIO_NUM_FORMAT_ARGS 8
|
|
||||||
#define FF_BLUETOOTHRADIO_DISPLAY_NAME "Bluetooth Radio"
|
#define FF_BLUETOOTHRADIO_DISPLAY_NAME "Bluetooth Radio"
|
||||||
|
|
||||||
static void printDevice(FFBluetoothRadioOptions* options, const FFBluetoothRadioResult* radio, uint8_t index)
|
static void printDevice(FFBluetoothRadioOptions* options, const FFBluetoothRadioResult* radio, uint8_t index)
|
||||||
@@ -17,7 +16,7 @@ static void printDevice(FFBluetoothRadioOptions* options, const FFBluetoothRadio
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(radio->name, "name"),
|
FF_FORMAT_ARG(radio->name, "name"),
|
||||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||||
@@ -55,7 +54,7 @@ static void printDevice(FFBluetoothRadioOptions* options, const FFBluetoothRadio
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BLUETOOTHRADIO_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(radio->name, "name"),
|
FF_FORMAT_ARG(radio->name, "name"),
|
||||||
FF_FORMAT_ARG(radio->address, "address"),
|
FF_FORMAT_ARG(radio->address, "address"),
|
||||||
FF_FORMAT_ARG(radio->lmpVersion, "lmp-version"),
|
FF_FORMAT_ARG(radio->lmpVersion, "lmp-version"),
|
||||||
@@ -181,33 +180,29 @@ void ffGenerateBluetoothRadioJsonResult(FF_MAYBE_UNUSED FFBluetoothRadioOptions*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintBluetoothRadioHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_BLUETOOTHRADIO_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BLUETOOTHRADIO_MODULE_NAME, "Bluetooth {5} ({6})", FF_BLUETOOTHRADIO_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "List bluetooth radios width supported version and vendor",
|
||||||
"Radio name for discovering - name",
|
.parseCommandOptions = (void*) ffParseBluetoothRadioCommandOptions,
|
||||||
"Address - local radio address",
|
.parseJsonObject = (void*) ffParseBluetoothRadioJsonObject,
|
||||||
"LMP version - lmp-version",
|
.printModule = (void*) ffPrintBluetoothRadio,
|
||||||
"LMP subversion - lmp-subversion",
|
.generateJsonResult = (void*) ffGenerateBluetoothRadioJsonResult,
|
||||||
"Bluetooth version - version",
|
.generateJsonConfig = (void*) ffGenerateBluetoothRadioJsonConfig,
|
||||||
"Vendor - vendor",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Discoverable - discoverable",
|
{"Radio name for discovering", "name"},
|
||||||
"Connectable / Pairable - connectable",
|
{"Address", "address"},
|
||||||
}));
|
{"LMP version", "lmp-version"},
|
||||||
}
|
{"LMP subversion", "lmp-subversion"},
|
||||||
|
{"Bluetooth version", "version"},
|
||||||
|
{"Vendor", "vendor"},
|
||||||
|
{"Discoverable", "discoverable"},
|
||||||
|
{"Connectable / Pairable", "connectable"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBluetoothRadioOptions(FFBluetoothRadioOptions* options)
|
void ffInitBluetoothRadioOptions(FFBluetoothRadioOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BLUETOOTHRADIO_MODULE_NAME,
|
|
||||||
"List bluetooth radios width supported version and vendor",
|
|
||||||
ffParseBluetoothRadioCommandOptions,
|
|
||||||
ffParseBluetoothRadioJsonObject,
|
|
||||||
ffPrintBluetoothRadio,
|
|
||||||
ffGenerateBluetoothRadioJsonResult,
|
|
||||||
ffPrintBluetoothRadioHelpFormat,
|
|
||||||
ffGenerateBluetoothRadioJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-23
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/board/board.h"
|
#include "modules/board/board.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_BOARD_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintBoard(FFBoardOptions* options)
|
void ffPrintBoard(FFBoardOptions* options)
|
||||||
{
|
{
|
||||||
FFBoardResult result;
|
FFBoardResult result;
|
||||||
@@ -37,7 +35,7 @@ void ffPrintBoard(FFBoardOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BOARD_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result.name, "name"),
|
FF_FORMAT_ARG(result.name, "name"),
|
||||||
FF_FORMAT_ARG(result.vendor, "vendor"),
|
FF_FORMAT_ARG(result.vendor, "vendor"),
|
||||||
FF_FORMAT_ARG(result.version, "version"),
|
FF_FORMAT_ARG(result.version, "version"),
|
||||||
@@ -122,29 +120,25 @@ exit:
|
|||||||
ffStrbufDestroy(&board.serial);
|
ffStrbufDestroy(&board.serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintBoardHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_BOARD_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BOARD_MODULE_NAME, "{1} ({3})", FF_BOARD_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print motherboard name and other info",
|
||||||
"board name - name",
|
.parseCommandOptions = (void*) ffParseBoardCommandOptions,
|
||||||
"board vendor - vendor",
|
.parseJsonObject = (void*) ffParseBoardJsonObject,
|
||||||
"board version - version",
|
.printModule = (void*) ffPrintBoard,
|
||||||
"board serial number - serial",
|
.generateJsonResult = (void*) ffGenerateBoardJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateBoardJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Board name", "name"},
|
||||||
|
{"Board vendor", "vendor"},
|
||||||
|
{"Board version", "version"},
|
||||||
|
{"Board serial number", "serial"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBoardOptions(FFBoardOptions* options)
|
void ffInitBoardOptions(FFBoardOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BOARD_MODULE_NAME,
|
|
||||||
"Print motherboard name and other info",
|
|
||||||
ffParseBoardCommandOptions,
|
|
||||||
ffParseBoardJsonObject,
|
|
||||||
ffPrintBoard,
|
|
||||||
ffGenerateBoardJsonResult,
|
|
||||||
ffPrintBoardHelpFormat,
|
|
||||||
ffGenerateBoardJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/bootmgr/bootmgr.h"
|
#include "modules/bootmgr/bootmgr.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_BOOTMGR_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintBootmgr(FFBootmgrOptions* options)
|
void ffPrintBootmgr(FFBootmgrOptions* options)
|
||||||
{
|
{
|
||||||
FFBootmgrResult bootmgr = {
|
FFBootmgrResult bootmgr = {
|
||||||
@@ -39,7 +37,7 @@ void ffPrintBootmgr(FFBootmgrOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_BOOTMGR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BOOTMGR_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_BOOTMGR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(bootmgr.name, "name"),
|
FF_FORMAT_ARG(bootmgr.name, "name"),
|
||||||
FF_FORMAT_ARG(bootmgr.firmware, "firmware-path"),
|
FF_FORMAT_ARG(bootmgr.firmware, "firmware-path"),
|
||||||
FF_FORMAT_ARG(firmwareName, "firmware-name"),
|
FF_FORMAT_ARG(firmwareName, "firmware-name"),
|
||||||
@@ -111,29 +109,25 @@ exit:
|
|||||||
ffStrbufDestroy(&bootmgr.firmware);
|
ffStrbufDestroy(&bootmgr.firmware);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintBootmgrHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_BOOTMGR_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BOOTMGR_MODULE_NAME, "{4} ({2})", FF_BOOTMGR_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print information of 2nd-stage bootloader (name, firmware, etc)",
|
||||||
"Name / description - name",
|
.parseCommandOptions = (void*) ffParseBootmgrCommandOptions,
|
||||||
"Firmware file path - firmware-path",
|
.parseJsonObject = (void*) ffParseBootmgrJsonObject,
|
||||||
"Firmware file name - firmware-name",
|
.printModule = (void*) ffPrintBootmgr,
|
||||||
"Is secure boot enabled - secure-boot",
|
.generateJsonResult = (void*) ffGenerateBootmgrJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateBootmgrJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Name / description", "name"},
|
||||||
|
{"Firmware file path", "firmware-path"},
|
||||||
|
{"Firmware file name", "firmware-name"},
|
||||||
|
{"Is secure boot enabled", "secure-boot"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBootmgrOptions(FFBootmgrOptions* options)
|
void ffInitBootmgrOptions(FFBootmgrOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BOOTMGR_MODULE_NAME,
|
|
||||||
"Print information of 2nd-stage bootloader (name, firmware, etc)",
|
|
||||||
ffParseBootmgrCommandOptions,
|
|
||||||
ffParseBootmgrJsonObject,
|
|
||||||
ffPrintBootmgr,
|
|
||||||
ffGenerateBootmgrJsonResult,
|
|
||||||
ffPrintBootmgrHelpFormat,
|
|
||||||
ffGenerateBootmgrJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,19 +16,17 @@ void ffParseBreakJsonObject(FF_MAYBE_UNUSED FFBreakOptions* options, FF_MAYBE_UN
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
|
.name = FF_BREAK_MODULE_NAME,
|
||||||
|
.description = "Print a empty line",
|
||||||
|
.parseCommandOptions = (void*) ffParseBreakCommandOptions,
|
||||||
|
.parseJsonObject = (void*) ffParseBreakJsonObject,
|
||||||
|
.printModule = (void*) ffPrintBreak,
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
void ffInitBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BREAK_MODULE_NAME,
|
|
||||||
"Print a empty line",
|
|
||||||
ffParseBreakCommandOptions,
|
|
||||||
ffParseBreakJsonObject,
|
|
||||||
ffPrintBreak,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffDestroyBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
void ffDestroyBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/brightness/brightness.h"
|
#include "modules/brightness/brightness.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_BRIGHTNESS_NUM_FORMAT_ARGS 6
|
|
||||||
|
|
||||||
void ffPrintBrightness(FFBrightnessOptions* options)
|
void ffPrintBrightness(FFBrightnessOptions* options)
|
||||||
{
|
{
|
||||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFBrightnessResult));
|
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFBrightnessResult));
|
||||||
@@ -57,7 +55,7 @@ void ffPrintBrightness(FFBrightnessOptions* options)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t moduleIndex = result.length == 1 ? 0 : index + 1;
|
uint32_t moduleIndex = result.length == 1 ? 0 : index + 1;
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(moduleIndex, "index"),
|
FF_FORMAT_ARG(moduleIndex, "index"),
|
||||||
FF_FORMAT_ARG(item->name, "name"),
|
FF_FORMAT_ARG(item->name, "name"),
|
||||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||||
@@ -95,7 +93,7 @@ void ffPrintBrightness(FFBrightnessOptions* options)
|
|||||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||||
ffPercentAppendBar(&valueBar, percent, options->percent, &options->moduleArgs);
|
ffPercentAppendBar(&valueBar, percent, options->percent, &options->moduleArgs);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BRIGHTNESS_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(valueNum, "percentage"),
|
FF_FORMAT_ARG(valueNum, "percentage"),
|
||||||
FF_FORMAT_ARG(item->name, "name"),
|
FF_FORMAT_ARG(item->name, "name"),
|
||||||
FF_FORMAT_ARG(item->max, "max"),
|
FF_FORMAT_ARG(item->max, "max"),
|
||||||
@@ -214,31 +212,27 @@ void ffGenerateBrightnessJsonResult(FF_MAYBE_UNUSED FFBrightnessOptions* options
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintBrightnessHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_BRIGHTNESS_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BRIGHTNESS_MODULE_NAME, "{1}", FF_BRIGHTNESS_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print current brightness level of your monitors",
|
||||||
"Screen brightness (percentage num) - percentage",
|
.parseCommandOptions = (void*) ffParseBrightnessCommandOptions,
|
||||||
"Screen name - name",
|
.parseJsonObject = (void*) ffParseBrightnessJsonObject,
|
||||||
"Maximum brightness value - max",
|
.printModule = (void*) ffPrintBrightness,
|
||||||
"Minimum brightness value - min",
|
.generateJsonResult = (void*) ffGenerateBrightnessJsonResult,
|
||||||
"Current brightness value - current",
|
.generateJsonConfig = (void*) ffGenerateBrightnessJsonConfig,
|
||||||
"Screen brightness (percentage bar) - percentage-bar",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}));
|
{"Screen brightness (percentage num)", "percentage"},
|
||||||
}
|
{"Screen name", "name"},
|
||||||
|
{"Maximum brightness value", "max"},
|
||||||
|
{"Minimum brightness value", "min"},
|
||||||
|
{"Current brightness value", "current"},
|
||||||
|
{"Screen brightness (percentage bar)", "percentage-bar"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBrightnessOptions(FFBrightnessOptions* options)
|
void ffInitBrightnessOptions(FFBrightnessOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BRIGHTNESS_MODULE_NAME,
|
|
||||||
"Print current brightness level of your monitors",
|
|
||||||
ffParseBrightnessCommandOptions,
|
|
||||||
ffParseBrightnessJsonObject,
|
|
||||||
ffPrintBrightness,
|
|
||||||
ffGenerateBrightnessJsonResult,
|
|
||||||
ffPrintBrightnessHelpFormat,
|
|
||||||
ffGenerateBrightnessJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->ddcciSleep = 10;
|
options->ddcciSleep = 10;
|
||||||
|
|||||||
+27
-33
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/btrfs/btrfs.h"
|
#include "modules/btrfs/btrfs.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_BTRFS_NUM_FORMAT_ARGS 13
|
|
||||||
|
|
||||||
static void printBtrfs(FFBtrfsOptions* options, FFBtrfsResult* result, uint8_t index)
|
static void printBtrfs(FFBtrfsOptions* options, FFBtrfsResult* result, uint8_t index)
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||||
@@ -20,7 +18,7 @@ static void printBtrfs(FFBtrfsOptions* options, FFBtrfsResult* result, uint8_t i
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ffStrbufClear(&buffer);
|
ffStrbufClear(&buffer);
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&buffer, &options->moduleArgs.key, 3, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&buffer, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(result->name, "name"),
|
FF_FORMAT_ARG(result->name, "name"),
|
||||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||||
@@ -80,7 +78,7 @@ static void printBtrfs(FFBtrfsOptions* options, FFBtrfsResult* result, uint8_t i
|
|||||||
FF_STRBUF_AUTO_DESTROY sectorSizePretty = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY sectorSizePretty = ffStrbufCreate();
|
||||||
ffParseSize(result->sectorSize, §orSizePretty);
|
ffParseSize(result->sectorSize, §orSizePretty);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(buffer.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BTRFS_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(buffer.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result->name, "name"),
|
FF_FORMAT_ARG(result->name, "name"),
|
||||||
FF_FORMAT_ARG(result->uuid, "uuid"),
|
FF_FORMAT_ARG(result->uuid, "uuid"),
|
||||||
FF_FORMAT_ARG(result->devices, "devices"),
|
FF_FORMAT_ARG(result->devices, "devices"),
|
||||||
@@ -218,38 +216,34 @@ void ffGenerateBtrfsJsonResult(FF_MAYBE_UNUSED FFBtrfsOptions* options, yyjson_m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintBtrfsHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_BTRFS_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_BTRFS_MODULE_NAME, "{5} / {7} ({8}, {9} allocated)", FF_BTRFS_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print Linux BTRFS volumes",
|
||||||
"Name / Label - name",
|
.parseCommandOptions = (void*) ffParseBtrfsCommandOptions,
|
||||||
"UUID - uuid",
|
.parseJsonObject = (void*) ffParseBtrfsJsonObject,
|
||||||
"Associated devices - devices",
|
.printModule = (void*) ffPrintBtrfs,
|
||||||
"Enabled features - features",
|
.generateJsonResult = (void*) ffGenerateBtrfsJsonResult,
|
||||||
"Size used - used",
|
.generateJsonConfig = (void*) ffGenerateBtrfsJsonConfig,
|
||||||
"Size allocated - allocated",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Size total - total",
|
{"Name / Label", "name"},
|
||||||
"Used percentage num - used-percentage",
|
{"UUID", "uuid"},
|
||||||
"Allocated percentage num - allocated-percentage",
|
{"Associated devices", "devices"},
|
||||||
"Used percentage bar - used-percentage-bar",
|
{"Enabled features", "features"},
|
||||||
"Allocated percentage bar - allocated-percentage-bar",
|
{"Size used", "used"},
|
||||||
"Node size - node-size",
|
{"Size allocated", "allocated"},
|
||||||
"Sector size - sector-size",
|
{"Size total", "total"},
|
||||||
}));
|
{"Used percentage num", "used-percentage"},
|
||||||
}
|
{"Allocated percentage num", "allocated-percentage"},
|
||||||
|
{"Used percentage bar", "used-percentage-bar"},
|
||||||
|
{"Allocated percentage bar", "allocated-percentage-bar"},
|
||||||
|
{"Node size", "node-size"},
|
||||||
|
{"Sector size", "sector-size"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitBtrfsOptions(FFBtrfsOptions* options)
|
void ffInitBtrfsOptions(FFBtrfsOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_BTRFS_MODULE_NAME,
|
|
||||||
"Print BTRFS volumes",
|
|
||||||
ffParseBtrfsCommandOptions,
|
|
||||||
ffParseBtrfsJsonObject,
|
|
||||||
ffPrintBtrfs,
|
|
||||||
ffGenerateBtrfsJsonResult,
|
|
||||||
ffPrintBtrfsHelpFormat,
|
|
||||||
ffGenerateBtrfsJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-25
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/camera/camera.h"
|
#include "modules/camera/camera.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_CAMERA_NUM_FORMAT_ARGS 6
|
|
||||||
|
|
||||||
static void printDevice(FFCameraOptions* options, const FFCameraResult* device, uint8_t index)
|
static void printDevice(FFCameraOptions* options, const FFCameraResult* device, uint8_t index)
|
||||||
{
|
{
|
||||||
if(options->moduleArgs.outputFormat.length == 0)
|
if(options->moduleArgs.outputFormat.length == 0)
|
||||||
@@ -27,7 +25,7 @@ static void printDevice(FFCameraOptions* options, const FFCameraResult* device,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_CAMERA_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CAMERA_NUM_FORMAT_ARGS, (((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_CAMERA_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, (((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(device->name, "name"),
|
FF_FORMAT_ARG(device->name, "name"),
|
||||||
FF_FORMAT_ARG(device->vendor, "vendor"),
|
FF_FORMAT_ARG(device->vendor, "vendor"),
|
||||||
FF_FORMAT_ARG(device->colorspace, "colorspace"),
|
FF_FORMAT_ARG(device->colorspace, "colorspace"),
|
||||||
@@ -136,31 +134,27 @@ void ffGenerateCameraJsonResult(FF_MAYBE_UNUSED FFCameraOptions* options, yyjson
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintCameraHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_CAMERA_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CAMERA_MODULE_NAME, "{1} ({4}px x {5}px)", FF_CAMERA_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print available cameras",
|
||||||
"Device name - name",
|
.parseCommandOptions = (void*) ffParseCameraCommandOptions,
|
||||||
"Vendor - vendor",
|
.parseJsonObject = (void*) ffParseCameraJsonObject,
|
||||||
"Color space - colorspace",
|
.printModule = (void*) ffPrintCamera,
|
||||||
"Identifier - id",
|
.generateJsonResult = (void*) ffGenerateCameraJsonResult,
|
||||||
"Width (in px) - width",
|
.generateJsonConfig = (void*) ffGenerateCameraJsonConfig,
|
||||||
"Height (in px) - height",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}));
|
{"Device name", "name"},
|
||||||
}
|
{"Vendor", "vendor"},
|
||||||
|
{"Color space", "colorspace"},
|
||||||
|
{"Identifier", "id"},
|
||||||
|
{"Width (in px)", "width"},
|
||||||
|
{"Height (in px)", "height"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitCameraOptions(FFCameraOptions* options)
|
void ffInitCameraOptions(FFCameraOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_CAMERA_MODULE_NAME,
|
|
||||||
"Print available cameras",
|
|
||||||
ffParseCameraCommandOptions,
|
|
||||||
ffParseCameraJsonObject,
|
|
||||||
ffPrintCamera,
|
|
||||||
ffGenerateCameraJsonResult,
|
|
||||||
ffPrintCameraHelpFormat,
|
|
||||||
ffGenerateCameraJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/chassis/chassis.h"
|
#include "modules/chassis/chassis.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_CHASSIS_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintChassis(FFChassisOptions* options)
|
void ffPrintChassis(FFChassisOptions* options)
|
||||||
{
|
{
|
||||||
FFChassisResult result;
|
FFChassisResult result;
|
||||||
@@ -38,7 +36,7 @@ void ffPrintChassis(FFChassisOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CHASSIS_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_CHASSIS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result.type, "type"),
|
FF_FORMAT_ARG(result.type, "type"),
|
||||||
FF_FORMAT_ARG(result.vendor, "vendor"),
|
FF_FORMAT_ARG(result.vendor, "vendor"),
|
||||||
FF_FORMAT_ARG(result.version, "version"),
|
FF_FORMAT_ARG(result.version, "version"),
|
||||||
@@ -123,29 +121,25 @@ exit:
|
|||||||
ffStrbufDestroy(&result.serial);
|
ffStrbufDestroy(&result.serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintChassisHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_CHASSIS_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CHASSIS_MODULE_NAME, "{1}", FF_CHASSIS_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print chassis type (desktop, laptop, etc)",
|
||||||
"chassis type - type",
|
.parseCommandOptions = (void*) ffParseChassisCommandOptions,
|
||||||
"chassis vendor - vendor",
|
.parseJsonObject = (void*) ffParseChassisJsonObject,
|
||||||
"chassis version - version",
|
.printModule = (void*) ffPrintChassis,
|
||||||
"chassis serial number - serial",
|
.generateJsonResult = (void*) ffGenerateChassisJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateChassisJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Chassis type", "type"},
|
||||||
|
{"Chassis vendor", "vendor"},
|
||||||
|
{"Chassis version", "version"},
|
||||||
|
{"Chassis serial number", "serial"},
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitChassisOptions(FFChassisOptions* options)
|
void ffInitChassisOptions(FFChassisOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_CHASSIS_MODULE_NAME,
|
|
||||||
"Print chassis type (desktop, laptop, etc)",
|
|
||||||
ffParseChassisCommandOptions,
|
|
||||||
ffParseChassisJsonObject,
|
|
||||||
ffPrintChassis,
|
|
||||||
ffGenerateChassisJsonResult,
|
|
||||||
ffPrintChassisHelpFormat,
|
|
||||||
ffGenerateChassisJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -291,19 +291,18 @@ void ffGenerateColorsJsonConfig(FFColorsOptions* options, yyjson_mut_doc* doc, y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
|
.name = FF_COLORS_MODULE_NAME,
|
||||||
|
.description = "Print some colored blocks",
|
||||||
|
.parseCommandOptions = (void*) ffParseColorsCommandOptions,
|
||||||
|
.parseJsonObject = (void*) ffParseColorsJsonObject,
|
||||||
|
.printModule = (void*) ffPrintColors,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateColorsJsonConfig,
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitColorsOptions(FFColorsOptions* options)
|
void ffInitColorsOptions(FFColorsOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_COLORS_MODULE_NAME,
|
|
||||||
"Print some colored blocks",
|
|
||||||
ffParseColorsCommandOptions,
|
|
||||||
ffParseColorsJsonObject,
|
|
||||||
ffPrintColors,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
ffGenerateColorsJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
||||||
options->symbol = FF_COLORS_SYMBOL_BACKGROUND;
|
options->symbol = FF_COLORS_SYMBOL_BACKGROUND;
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/command/command.h"
|
#include "modules/command/command.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_COMMAND_NUM_FORMAT_ARGS 1
|
|
||||||
|
|
||||||
void ffPrintCommand(FFCommandOptions* options)
|
void ffPrintCommand(FFCommandOptions* options)
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY result = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY result = ffStrbufCreate();
|
||||||
@@ -39,7 +37,7 @@ void ffPrintCommand(FFCommandOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_COMMAND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_COMMAND_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_COMMAND_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result, "result")
|
FF_FORMAT_ARG(result, "result")
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -154,26 +152,22 @@ void ffGenerateCommandJsonResult(FF_MAYBE_UNUSED FFCommandOptions* options, yyjs
|
|||||||
yyjson_mut_obj_add_strbuf(doc, module, "result", &result);
|
yyjson_mut_obj_add_strbuf(doc, module, "result", &result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintCommandHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_COMMAND_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_COMMAND_MODULE_NAME, "{1}", FF_COMMAND_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Run custom shell scripts",
|
||||||
"Command result - result"
|
.parseCommandOptions = (void*) ffParseCommandCommandOptions,
|
||||||
}));
|
.parseJsonObject = (void*) ffParseCommandJsonObject,
|
||||||
}
|
.printModule = (void*) ffPrintCommand,
|
||||||
|
.generateJsonResult = (void*) ffGenerateCommandJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateCommandJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Command result", "result"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitCommandOptions(FFCommandOptions* options)
|
void ffInitCommandOptions(FFCommandOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_COMMAND_MODULE_NAME,
|
|
||||||
"Running custom shell scripts",
|
|
||||||
ffParseCommandCommandOptions,
|
|
||||||
ffParseCommandJsonObject,
|
|
||||||
ffPrintCommand,
|
|
||||||
ffGenerateCommandJsonResult,
|
|
||||||
ffPrintCommandHelpFormat,
|
|
||||||
ffGenerateCommandJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
ffStrbufInitStatic(&options->shell,
|
ffStrbufInitStatic(&options->shell,
|
||||||
|
|||||||
+23
-29
@@ -6,8 +6,6 @@
|
|||||||
#include "modules/cpu/cpu.h"
|
#include "modules/cpu/cpu.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_CPU_NUM_FORMAT_ARGS 10
|
|
||||||
|
|
||||||
static int sortCores(const FFCPUCore* a, const FFCPUCore* b)
|
static int sortCores(const FFCPUCore* a, const FFCPUCore* b)
|
||||||
{
|
{
|
||||||
return (int)b->freq - (int)a->freq;
|
return (int)b->freq - (int)a->freq;
|
||||||
@@ -104,7 +102,7 @@ void ffPrintCPU(FFCPUOptions* options)
|
|||||||
|
|
||||||
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
|
||||||
ffTempsAppendNum(cpu.temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
ffTempsAppendNum(cpu.temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPU_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(cpu.name, "name"),
|
FF_FORMAT_ARG(cpu.name, "name"),
|
||||||
FF_FORMAT_ARG(cpu.vendor, "vendor"),
|
FF_FORMAT_ARG(cpu.vendor, "vendor"),
|
||||||
FF_FORMAT_ARG(cpu.coresPhysical, "cores-physical"),
|
FF_FORMAT_ARG(cpu.coresPhysical, "cores-physical"),
|
||||||
@@ -241,35 +239,31 @@ void ffGenerateCPUJsonResult(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
|||||||
ffStrbufDestroy(&cpu.vendor);
|
ffStrbufDestroy(&cpu.vendor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintCPUHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_CPU_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CPU_MODULE_NAME, "{1} ({5}) @ {7} GHz", FF_CPU_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print CPU name, frequency, etc",
|
||||||
"Name - name",
|
.parseCommandOptions = (void*) ffParseCPUCommandOptions,
|
||||||
"Vendor - vendor",
|
.parseJsonObject = (void*) ffParseCPUJsonObject,
|
||||||
"Physical core count - cores-physical",
|
.printModule = (void*) ffPrintCPU,
|
||||||
"Logical core count - cores-logical",
|
.generateJsonResult = (void*) ffGenerateCPUJsonResult,
|
||||||
"Online core count - cores-online",
|
.generateJsonConfig = (void*) ffGenerateCPUJsonConfig,
|
||||||
"Base frequency (formatted) - freq-base",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Max frequency (formatted) - freq-max",
|
{"Name", "name"},
|
||||||
"Temperature (formatted) - temperature",
|
{"Vendor", "vendor"},
|
||||||
"Logical core count grouped by frequency - core-types",
|
{"Physical core count", "cores-physical"},
|
||||||
"Processor package count - packages",
|
{"Logical core count", "cores-logical"},
|
||||||
}));
|
{"Online core count", "cores-online"},
|
||||||
}
|
{"Base frequency (formatted)", "freq-base"},
|
||||||
|
{"Max frequency (formatted)", "freq-max"},
|
||||||
|
{"Temperature (formatted)", "temperature"},
|
||||||
|
{"Logical core count grouped by frequency", "core-types"},
|
||||||
|
{"Processor package count", "packages"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitCPUOptions(FFCPUOptions* options)
|
void ffInitCPUOptions(FFCPUOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_CPU_MODULE_NAME,
|
|
||||||
"Print CPU name, frequency, etc",
|
|
||||||
ffParseCPUCommandOptions,
|
|
||||||
ffParseCPUJsonObject,
|
|
||||||
ffPrintCPU,
|
|
||||||
ffGenerateCPUJsonResult,
|
|
||||||
ffPrintCPUHelpFormat,
|
|
||||||
ffGenerateCPUJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->temp = false;
|
options->temp = false;
|
||||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_CPUCACHE_DISPLAY_NAME "CPU Cache"
|
#define FF_CPUCACHE_DISPLAY_NAME "CPU Cache"
|
||||||
#define FF_CPUCACHE_NUM_FORMAT_ARGS 2
|
|
||||||
|
|
||||||
static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOptions* options)
|
static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOptions* options)
|
||||||
{
|
{
|
||||||
@@ -22,7 +21,7 @@ static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOption
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t index = i + 1;
|
uint32_t index = i + 1;
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(levelStr, "level"),
|
FF_FORMAT_ARG(levelStr, "level"),
|
||||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||||
@@ -61,7 +60,7 @@ static void printCPUCacheNormal(const FFCPUCacheResult* result, FFCPUCacheOption
|
|||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY buffer2 = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY buffer2 = ffStrbufCreate();
|
||||||
ffParseSize(sum, &buffer2);
|
ffParseSize(sum, &buffer2);
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_CPUCACHE_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(buffer, "result"),
|
FF_FORMAT_ARG(buffer, "result"),
|
||||||
FF_FORMAT_ARG(buffer2, "sum"),
|
FF_FORMAT_ARG(buffer2, "sum"),
|
||||||
}));
|
}));
|
||||||
@@ -94,7 +93,7 @@ static void printCPUCacheCompact(const FFCPUCacheResult* result, FFCPUCacheOptio
|
|||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY buffer2 = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY buffer2 = ffStrbufCreate();
|
||||||
ffParseSize(sum, &buffer2);
|
ffParseSize(sum, &buffer2);
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_CPUCACHE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPUCACHE_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_CPUCACHE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(buffer, "result"),
|
FF_FORMAT_ARG(buffer, "result"),
|
||||||
FF_FORMAT_ARG(buffer2, "sum"),
|
FF_FORMAT_ARG(buffer2, "sum"),
|
||||||
}));
|
}));
|
||||||
@@ -228,27 +227,23 @@ exit:
|
|||||||
ffListDestroy(&result.caches[3]);
|
ffListDestroy(&result.caches[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintCPUCacheHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_CPUCACHE_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CPUCACHE_DISPLAY_NAME, "{1}", FF_CPUCACHE_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print CPU cache sizes",
|
||||||
"Separate result - result",
|
.parseCommandOptions = (void*) ffParseCPUCacheCommandOptions,
|
||||||
"Sum result - sum",
|
.parseJsonObject = (void*) ffParseCPUCacheJsonObject,
|
||||||
}));
|
.printModule = (void*) ffPrintCPUCache,
|
||||||
}
|
.generateJsonResult = (void*) ffGenerateCPUCacheJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateCPUCacheJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Separate result", "result"},
|
||||||
|
{"Sum result", "sum"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitCPUCacheOptions(FFCPUCacheOptions* options)
|
void ffInitCPUCacheOptions(FFCPUCacheOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_CPUCACHE_MODULE_NAME,
|
|
||||||
"Print CPU cache sizes",
|
|
||||||
ffParseCPUCacheCommandOptions,
|
|
||||||
ffParseCPUCacheJsonObject,
|
|
||||||
ffPrintCPUCache,
|
|
||||||
ffGenerateCPUCacheJsonResult,
|
|
||||||
ffPrintCPUCacheHelpFormat,
|
|
||||||
ffGenerateCPUCacheJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->compact = false;
|
options->compact = false;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_CPUUSAGE_DISPLAY_NAME "CPU Usage"
|
#define FF_CPUUSAGE_DISPLAY_NAME "CPU Usage"
|
||||||
#define FF_CPUUSAGE_NUM_FORMAT_ARGS 8
|
|
||||||
|
|
||||||
void ffPrintCPUUsage(FFCPUUsageOptions* options)
|
void ffPrintCPUUsage(FFCPUUsageOptions* options)
|
||||||
{
|
{
|
||||||
@@ -94,7 +93,7 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options)
|
|||||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||||
ffPercentAppendBar(&maxBar, maxValue, options->percent, &options->moduleArgs);
|
ffPercentAppendBar(&maxBar, maxValue, options->percent, &options->moduleArgs);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_CPUUSAGE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPUUSAGE_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_CPUUSAGE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(avgNum, "avg"),
|
FF_FORMAT_ARG(avgNum, "avg"),
|
||||||
FF_FORMAT_ARG(maxNum, "max"),
|
FF_FORMAT_ARG(maxNum, "max"),
|
||||||
FF_FORMAT_ARG(maxIndex, "max-index"),
|
FF_FORMAT_ARG(maxIndex, "max-index"),
|
||||||
@@ -194,33 +193,29 @@ void ffGenerateCPUUsageJsonResult(FFCPUUsageOptions* options, yyjson_mut_doc* do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintCPUUsageHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_CPUUSAGE_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CPUUSAGE_MODULE_NAME, "{1}", FF_CPUUSAGE_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print CPU usage. Costs some time to collect data",
|
||||||
"CPU usage (percentage num, average) - avg",
|
.parseCommandOptions = (void*) ffParseCPUUsageCommandOptions,
|
||||||
"CPU usage (percentage num, maximum) - max",
|
.parseJsonObject = (void*) ffParseCPUUsageJsonObject,
|
||||||
"CPU core index of maximum usage - max-index",
|
.printModule = (void*) ffPrintCPUUsage,
|
||||||
"CPU usage (percentage num, minimum) - min",
|
.generateJsonResult = (void*) ffGenerateCPUUsageJsonResult,
|
||||||
"CPU core index of minimum usage - min-index",
|
.generateJsonConfig = (void*) ffGenerateCPUUsageJsonConfig,
|
||||||
"CPU usage (percentage bar, average) - avg-bar",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"CPU usage (percentage bar, maximum) - max-bar",
|
{"CPU usage (percentage num, average)", "avg"},
|
||||||
"CPU usage (percentage bar, minimum) - min-bar",
|
{"CPU usage (percentage num, maximum)", "max"},
|
||||||
}));
|
{"CPU core index of maximum usage", "max-index"},
|
||||||
}
|
{"CPU usage (percentage num, minimum)", "min"},
|
||||||
|
{"CPU core index of minimum usage", "min-index"},
|
||||||
|
{"CPU usage (percentage bar, average)", "avg-bar"},
|
||||||
|
{"CPU usage (percentage bar, maximum)", "max-bar"},
|
||||||
|
{"CPU usage (percentage bar, minimum)", "min-bar"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitCPUUsageOptions(FFCPUUsageOptions* options)
|
void ffInitCPUUsageOptions(FFCPUUsageOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_CPUUSAGE_MODULE_NAME,
|
|
||||||
"Print CPU usage. Costs some time to collect data",
|
|
||||||
ffParseCPUUsageCommandOptions,
|
|
||||||
ffParseCPUUsageJsonObject,
|
|
||||||
ffPrintCPUUsage,
|
|
||||||
ffGenerateCPUUsageJsonResult,
|
|
||||||
ffPrintCPUUsageHelpFormat,
|
|
||||||
ffGenerateCPUUsageJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->separate = false;
|
options->separate = false;
|
||||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||||
|
|||||||
+15
-21
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/cursor/cursor.h"
|
#include "modules/cursor/cursor.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_CURSOR_NUM_FORMAT_ARGS 2
|
|
||||||
|
|
||||||
void ffPrintCursor(FFCursorOptions* options)
|
void ffPrintCursor(FFCursorOptions* options)
|
||||||
{
|
{
|
||||||
FFCursorResult result;
|
FFCursorResult result;
|
||||||
@@ -38,7 +36,7 @@ void ffPrintCursor(FFCursorOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_CURSOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CURSOR_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_CURSOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result.theme, "theme"),
|
FF_FORMAT_ARG(result.theme, "theme"),
|
||||||
FF_FORMAT_ARG(result.size, "size"),
|
FF_FORMAT_ARG(result.size, "size"),
|
||||||
}));
|
}));
|
||||||
@@ -110,27 +108,23 @@ void ffGenerateCursorJsonResult(FF_MAYBE_UNUSED FFCursorOptions* options, yyjson
|
|||||||
ffStrbufDestroy(&result.size);
|
ffStrbufDestroy(&result.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintCursorHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_CURSOR_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_CURSOR_MODULE_NAME, "{1} ({2}px)", FF_CURSOR_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print cursor style name",
|
||||||
"Cursor theme - theme",
|
.parseCommandOptions = (void*) ffParseCursorCommandOptions,
|
||||||
"Cursor size - size"
|
.parseJsonObject = (void*) ffParseCursorJsonObject,
|
||||||
}));
|
.printModule = (void*) ffPrintCursor,
|
||||||
}
|
.generateJsonResult = (void*) ffGenerateCursorJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateCursorJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Cursor theme", "theme"},
|
||||||
|
{"Cursor size", "size"},
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitCursorOptions(FFCursorOptions* options)
|
void ffInitCursorOptions(FFCursorOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_CURSOR_MODULE_NAME,
|
|
||||||
"Print cursor style name",
|
|
||||||
ffParseCursorCommandOptions,
|
|
||||||
ffParseCursorJsonObject,
|
|
||||||
ffPrintCursor,
|
|
||||||
ffGenerateCursorJsonResult,
|
|
||||||
ffPrintCursorHelpFormat,
|
|
||||||
ffGenerateCursorJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-11
@@ -44,19 +44,18 @@ void ffParseCustomJsonObject(FFCustomOptions* options, yyjson_val* module)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
|
.name = FF_CUSTOM_MODULE_NAME,
|
||||||
|
.description = "Print a custom string, with or without key",
|
||||||
|
.parseCommandOptions = (void*) ffParseCustomCommandOptions,
|
||||||
|
.parseJsonObject = (void*) ffParseCustomJsonObject,
|
||||||
|
.printModule = (void*) ffPrintCustom,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateCustomJsonConfig,
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitCustomOptions(FFCustomOptions* options)
|
void ffInitCustomOptions(FFCustomOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_CUSTOM_MODULE_NAME,
|
|
||||||
"Print a custom string, with or without key",
|
|
||||||
ffParseCustomCommandOptions,
|
|
||||||
ffParseCustomJsonObject,
|
|
||||||
ffPrintCustom,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
ffGenerateCustomJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wformat" // warning: unknown conversion type character 'F' in format
|
#pragma GCC diagnostic ignored "-Wformat" // warning: unknown conversion type character 'F' in format
|
||||||
|
|
||||||
#define FF_DATETIME_DISPLAY_NAME "Date & Time"
|
#define FF_DATETIME_DISPLAY_NAME "Date & Time"
|
||||||
#define FF_DATETIME_NUM_FORMAT_ARGS 23
|
|
||||||
|
|
||||||
typedef struct FFDateTimeResult
|
typedef struct FFDateTimeResult
|
||||||
{
|
{
|
||||||
@@ -67,7 +66,7 @@ void ffPrintDateTimeFormat(struct tm* tm, const FFModuleArgs* moduleArgs)
|
|||||||
strftime(result.offsetFromUtc, sizeof(result.offsetFromUtc), "%z", tm);
|
strftime(result.offsetFromUtc, sizeof(result.offsetFromUtc), "%z", tm);
|
||||||
strftime(result.timezoneName, sizeof(result.timezoneName), "%Z", tm);
|
strftime(result.timezoneName, sizeof(result.timezoneName), "%Z", tm);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_DATETIME_DISPLAY_NAME, 0, moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_DATETIME_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_DATETIME_DISPLAY_NAME, 0, moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result.year, "year"), // 1
|
FF_FORMAT_ARG(result.year, "year"), // 1
|
||||||
FF_FORMAT_ARG(result.yearShort, "year-short"), // 2
|
FF_FORMAT_ARG(result.yearShort, "year-short"), // 2
|
||||||
FF_FORMAT_ARG(result.month, "month"), // 3
|
FF_FORMAT_ARG(result.month, "month"), // 3
|
||||||
@@ -158,48 +157,44 @@ void ffGenerateDateTimeJsonResult(FF_MAYBE_UNUSED FFDateTimeOptions* options, yy
|
|||||||
yyjson_mut_obj_add_strcpy(doc, module, "result", ffTimeToFullStr(ffTimeGetNow()));
|
yyjson_mut_obj_add_strcpy(doc, module, "result", ffTimeToFullStr(ffTimeGetNow()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintDateTimeHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_DATETIME_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DATETIME_MODULE_NAME, "{1}-{4}-{23} {14}:{18}:{20}", FF_DATETIME_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print current date and time",
|
||||||
"year - year",
|
.parseCommandOptions = (void*) ffParseDateTimeCommandOptions,
|
||||||
"last two digits of year - year-short",
|
.parseJsonObject = (void*) ffParseDateTimeJsonObject,
|
||||||
"month - month",
|
.printModule = (void*) ffPrintDateTime,
|
||||||
"month with leading zero - month-pretty",
|
.generateJsonResult = (void*) ffGenerateDateTimeJsonResult,
|
||||||
"month name - month-name",
|
.generateJsonConfig = (void*) ffGenerateDateTimeJsonConfig,
|
||||||
"month name short - month-name-short",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"week number on year - week",
|
{"Year", "year"},
|
||||||
"weekday - weekday",
|
{"Last two digits of year", "year-short"},
|
||||||
"weekday short - weekday-short",
|
{"Month", "month"},
|
||||||
"day in year - day-in-year",
|
{"Month with leading zero", "month-pretty"},
|
||||||
"day in month - day-in-month",
|
{"Month name", "month-name"},
|
||||||
"day in week - day-in-week",
|
{"Month name short", "month-name-short"},
|
||||||
"hour - hour",
|
{"Week number on year", "week"},
|
||||||
"hour with leading zero - hour-pretty",
|
{"Weekday", "weekday"},
|
||||||
"hour 12h format - hour-12",
|
{"Weekday short", "weekday-short"},
|
||||||
"hour 12h format with leading zero - hour-12-pretty",
|
{"Day in year", "day-in-year"},
|
||||||
"minute - minute",
|
{"Day in month", "day-in-month"},
|
||||||
"minute with leading zero - minute-pretty",
|
{"Day in week", "day-in-week"},
|
||||||
"second - second",
|
{"Hour", "hour"},
|
||||||
"second with leading zero - second-pretty",
|
{"Hour with leading zero", "hour-pretty"},
|
||||||
"offset from UTC in the ISO 8601 format - offset-from-utc",
|
{"Hour 12h format", "hour-12"},
|
||||||
"locale-dependent timezone name or abbreviation - timezone-name",
|
{"Hour 12h format with leading zero", "hour-12-pretty"},
|
||||||
"day in month with leading zero - day-pretty",
|
{"Minute", "minute"},
|
||||||
}));
|
{"Minute with leading zero", "minute-pretty"},
|
||||||
}
|
{"Second", "second"},
|
||||||
|
{"Second with leading zero", "second-pretty"},
|
||||||
|
{"Offset from UTC in the ISO 8601 format", "offset-from-utc"},
|
||||||
|
{"Locale-dependent timezone name or abbreviation", "timezone-name"},
|
||||||
|
{"Day in month with leading zero", "day-pretty"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitDateTimeOptions(FFDateTimeOptions* options)
|
void ffInitDateTimeOptions(FFDateTimeOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_DATETIME_MODULE_NAME,
|
|
||||||
"Print current date and time",
|
|
||||||
ffParseDateTimeCommandOptions,
|
|
||||||
ffParseDateTimeJsonObject,
|
|
||||||
ffPrintDateTime,
|
|
||||||
ffGenerateDateTimeJsonResult,
|
|
||||||
ffPrintDateTimeHelpFormat,
|
|
||||||
ffGenerateDateTimeJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-22
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/de/de.h"
|
#include "modules/de/de.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_DE_NUM_FORMAT_ARGS 3
|
|
||||||
|
|
||||||
void ffPrintDE(FFDEOptions* options)
|
void ffPrintDE(FFDEOptions* options)
|
||||||
{
|
{
|
||||||
const FFDisplayServerResult* result = ffConnectDisplayServer();
|
const FFDisplayServerResult* result = ffConnectDisplayServer();
|
||||||
@@ -36,7 +34,7 @@ void ffPrintDE(FFDEOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_DE_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result->deProcessName, "process-name"),
|
FF_FORMAT_ARG(result->deProcessName, "process-name"),
|
||||||
FF_FORMAT_ARG(result->dePrettyName, "pretty-name"),
|
FF_FORMAT_ARG(result->dePrettyName, "pretty-name"),
|
||||||
FF_FORMAT_ARG(version, "version")
|
FF_FORMAT_ARG(version, "version")
|
||||||
@@ -113,28 +111,24 @@ void ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc
|
|||||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &version);
|
yyjson_mut_obj_add_strbuf(doc, obj, "version", &version);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintDEHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_DE_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DE_MODULE_NAME, "{2} {3}", FF_DE_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print desktop environment name",
|
||||||
"DE process name - process-name",
|
.parseCommandOptions = (void*) ffParseDECommandOptions,
|
||||||
"DE pretty name - pretty-name",
|
.parseJsonObject = (void*) ffParseDEJsonObject,
|
||||||
"DE version - version"
|
.printModule = (void*) ffPrintDE,
|
||||||
}));
|
.generateJsonResult = (void*) ffGenerateDEJsonResult,
|
||||||
}
|
.generateJsonConfig = (void*) ffGenerateDEJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"DE process name", "process-name"},
|
||||||
|
{"DE pretty name", "pretty-name"},
|
||||||
|
{"DE version", "version"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitDEOptions(FFDEOptions* options)
|
void ffInitDEOptions(FFDEOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_DE_MODULE_NAME,
|
|
||||||
"Print desktop environment name",
|
|
||||||
ffParseDECommandOptions,
|
|
||||||
ffParseDEJsonObject,
|
|
||||||
ffPrintDE,
|
|
||||||
ffGenerateDEJsonResult,
|
|
||||||
ffPrintDEHelpFormat,
|
|
||||||
ffGenerateDEJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->slowVersionDetection = false;
|
options->slowVersionDetection = false;
|
||||||
|
|||||||
+29
-33
@@ -7,7 +7,6 @@
|
|||||||
#include "modules/disk/disk.h"
|
#include "modules/disk/disk.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_DISK_NUM_FORMAT_ARGS 14
|
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
|
|
||||||
static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index)
|
static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index)
|
||||||
@@ -35,7 +34,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 5, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(disk->mountpoint, "mountpoint"),
|
FF_FORMAT_ARG(disk->mountpoint, "mountpoint"),
|
||||||
FF_FORMAT_ARG(disk->name, "name"),
|
FF_FORMAT_ARG(disk->name, "name"),
|
||||||
FF_FORMAT_ARG(disk->mountFrom, "mount-from"),
|
FF_FORMAT_ARG(disk->mountFrom, "mount-from"),
|
||||||
@@ -126,7 +125,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index
|
|||||||
bool isHidden = !!(disk->type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT);
|
bool isHidden = !!(disk->type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT);
|
||||||
bool isReadOnly = !!(disk->type & FF_DISK_VOLUME_TYPE_READONLY_BIT);
|
bool isReadOnly = !!(disk->type & FF_DISK_VOLUME_TYPE_READONLY_BIT);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISK_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(usedPretty, "size-used"),
|
FF_FORMAT_ARG(usedPretty, "size-used"),
|
||||||
FF_FORMAT_ARG(totalPretty, "size-total"),
|
FF_FORMAT_ARG(totalPretty, "size-total"),
|
||||||
FF_FORMAT_ARG(bytesPercentageNum, "size-percentage"),
|
FF_FORMAT_ARG(bytesPercentageNum, "size-percentage"),
|
||||||
@@ -440,39 +439,36 @@ void ffGenerateDiskJsonResult(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintDiskHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_DISK_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DISK_MODULE_NAME, "{1} / {2} ({3}) - {9}", FF_DISK_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print partitions, space usage, file system, etc",
|
||||||
"Size used - size-used",
|
.parseCommandOptions = (void*) ffParseDiskCommandOptions,
|
||||||
"Size total - size-total",
|
.parseJsonObject = (void*) ffParseDiskJsonObject,
|
||||||
"Size percentage num - size-percentage",
|
.printModule = (void*) ffPrintDisk,
|
||||||
"Files used - files-used",
|
.generateJsonResult = (void*) ffGenerateDiskJsonResult,
|
||||||
"Files total - files-total",
|
.generateJsonConfig = (void*) ffGenerateDiskJsonConfig,
|
||||||
"Files percentage num - files-percentage",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"True if external volume - is-external",
|
{"Size used", "size-used"},
|
||||||
"True if hidden volume - is-hidden",
|
{"Size total", "size-total"},
|
||||||
"Filesystem - filesystem",
|
{"Size percentage num", "size-percentage"},
|
||||||
"Label / name - name",
|
{"Files used", "files-used"},
|
||||||
"True if read-only - is-readonly",
|
{"Files total", "files-total"},
|
||||||
"Create time in local timezone - create-time",
|
{"Files percentage num", "files-percentage"},
|
||||||
"Size percentage bar - size-percentage-bar",
|
{"True if external volume", "is-external"},
|
||||||
"Files percentage bar - files-percentage-bar",
|
{"True if hidden volume", "is-hidden"},
|
||||||
}));
|
{"Filesystem", "filesystem"},
|
||||||
}
|
{"Label / name", "name"},
|
||||||
|
{"True if read-only", "is-readonly"},
|
||||||
|
{"Create time in local timezone", "create-time"},
|
||||||
|
{"Size percentage bar", "size-percentage-bar"},
|
||||||
|
{"Files percentage bar", "files-percentage-bar"},
|
||||||
|
{},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitDiskOptions(FFDiskOptions* options)
|
void ffInitDiskOptions(FFDiskOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_DISK_MODULE_NAME,
|
|
||||||
"Print partitions, space usage, file system, etc",
|
|
||||||
ffParseDiskCommandOptions,
|
|
||||||
ffParseDiskJsonObject,
|
|
||||||
ffPrintDisk,
|
|
||||||
ffGenerateDiskJsonResult,
|
|
||||||
ffPrintDiskHelpFormat,
|
|
||||||
ffGenerateDiskJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
ffStrbufInit(&options->folders);
|
ffStrbufInit(&options->folders);
|
||||||
|
|||||||
+22
-27
@@ -6,7 +6,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_DISKIO_DISPLAY_NAME "Disk IO"
|
#define FF_DISKIO_DISPLAY_NAME "Disk IO"
|
||||||
#define FF_DISKIO_NUM_FORMAT_ARGS 8
|
|
||||||
|
|
||||||
static int sortDevices(const FFDiskIOResult* left, const FFDiskIOResult* right)
|
static int sortDevices(const FFDiskIOResult* left, const FFDiskIOResult* right)
|
||||||
{
|
{
|
||||||
@@ -22,7 +21,7 @@ static void formatKey(const FFDiskIOOptions* options, FFDiskIOResult* dev, uint3
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ffStrbufClear(key);
|
ffStrbufClear(key);
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 4, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(dev->name, "name"),
|
FF_FORMAT_ARG(dev->name, "name"),
|
||||||
FF_FORMAT_ARG(dev->devPath, "dev-path"),
|
FF_FORMAT_ARG(dev->devPath, "dev-path"),
|
||||||
@@ -75,7 +74,7 @@ void ffPrintDiskIO(FFDiskIOOptions* options)
|
|||||||
ffParseSize(dev->bytesWritten, &buffer2);
|
ffParseSize(dev->bytesWritten, &buffer2);
|
||||||
if (!options->detectTotal) ffStrbufAppendS(&buffer, "/s");
|
if (!options->detectTotal) ffStrbufAppendS(&buffer, "/s");
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISKIO_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(buffer, "size-read"),
|
FF_FORMAT_ARG(buffer, "size-read"),
|
||||||
FF_FORMAT_ARG(buffer2, "size-written"),
|
FF_FORMAT_ARG(buffer2, "size-written"),
|
||||||
FF_FORMAT_ARG(dev->name, "name"),
|
FF_FORMAT_ARG(dev->name, "name"),
|
||||||
@@ -203,33 +202,29 @@ void ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintDiskIOHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_DISKIO_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DISKIO_MODULE_NAME, "{1} (R) - {2} (W)", FF_DISKIO_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print physical disk I/O throughput",
|
||||||
"Size of data read [per second] (formatted) - size-read",
|
.parseCommandOptions = (void*) ffParseDiskIOCommandOptions,
|
||||||
"Size of data written [per second] (formatted) - size-written",
|
.parseJsonObject = (void*) ffParseDiskIOJsonObject,
|
||||||
"Device name - name",
|
.printModule = (void*) ffPrintDiskIO,
|
||||||
"Device raw file path - dev-path",
|
.generateJsonResult = (void*) ffGenerateDiskIOJsonResult,
|
||||||
"Size of data read [per second] (in bytes) - bytes-read",
|
.generateJsonConfig = (void*) ffGenerateDiskIOJsonConfig,
|
||||||
"Size of data written [per second] (in bytes) - bytes-written",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Number of reads - read-count",
|
{"Size of data read [per second] (formatted)", "size-read"},
|
||||||
"Number of writes - write-count",
|
{"Size of data written [per second] (formatted)", "size-written"},
|
||||||
}));
|
{"Device name", "name"},
|
||||||
}
|
{"Device raw file path", "dev-path"},
|
||||||
|
{"Size of data read [per second] (in bytes)", "bytes-read"},
|
||||||
|
{"Size of data written [per second] (in bytes)", "bytes-written"},
|
||||||
|
{"Number of reads", "read-count"},
|
||||||
|
{"Number of writes", "write-count"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitDiskIOOptions(FFDiskIOOptions* options)
|
void ffInitDiskIOOptions(FFDiskIOOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_DISKIO_MODULE_NAME,
|
|
||||||
"Print physical disk I/O throughput",
|
|
||||||
ffParseDiskIOCommandOptions,
|
|
||||||
ffParseDiskIOJsonObject,
|
|
||||||
ffPrintDiskIO,
|
|
||||||
ffGenerateDiskIOJsonResult,
|
|
||||||
ffPrintDiskIOHelpFormat,
|
|
||||||
ffGenerateDiskIOJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
ffStrbufInit(&options->namePrefix);
|
ffStrbufInit(&options->namePrefix);
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define FF_DISPLAY_NUM_FORMAT_ARGS 24
|
|
||||||
|
|
||||||
static int sortByNameAsc(FFDisplayResult* a, FFDisplayResult* b)
|
static int sortByNameAsc(FFDisplayResult* a, FFDisplayResult* b)
|
||||||
{
|
{
|
||||||
return ffStrbufComp(&a->name, &b->name);
|
return ffStrbufComp(&a->name, &b->name);
|
||||||
@@ -91,7 +89,7 @@ void ffPrintDisplay(FFDisplayOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 4, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(moduleIndex, "index"),
|
FF_FORMAT_ARG(moduleIndex, "index"),
|
||||||
FF_FORMAT_ARG(result->name, "name"),
|
FF_FORMAT_ARG(result->name, "name"),
|
||||||
FF_FORMAT_ARG(displayType, "type"),
|
FF_FORMAT_ARG(displayType, "type"),
|
||||||
@@ -186,7 +184,7 @@ void ffPrintDisplay(FFDisplayOptions* options)
|
|||||||
|
|
||||||
double scaleFactor = (double) result->width / (double) result->scaledWidth;
|
double scaleFactor = (double) result->width / (double) result->scaledWidth;
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISPLAY_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result->width, "width"),
|
FF_FORMAT_ARG(result->width, "width"),
|
||||||
FF_FORMAT_ARG(result->height, "height"),
|
FF_FORMAT_ARG(result->height, "height"),
|
||||||
FF_FORMAT_ARG(refreshRate, "refresh-rate"),
|
FF_FORMAT_ARG(refreshRate, "refresh-rate"),
|
||||||
@@ -435,49 +433,45 @@ void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintDisplayHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_DISPLAY_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DISPLAY_MODULE_NAME, "{1}x{2} @ {3}Hz (as {4}x{5}) [{7}]", FF_DISPLAY_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print resolutions, refresh rates, etc",
|
||||||
"Screen configured width (in pixels) - width",
|
.parseCommandOptions = (void*) ffParseDisplayCommandOptions,
|
||||||
"Screen configured height (in pixels) - height",
|
.parseJsonObject = (void*) ffParseDisplayJsonObject,
|
||||||
"Screen configured refresh rate (in Hz) - refresh-rate",
|
.printModule = (void*) ffPrintDisplay,
|
||||||
"Screen scaled width (in pixels) - scaled-width",
|
.generateJsonResult = (void*) ffGenerateDisplayJsonResult,
|
||||||
"Screen scaled height (in pixels) - scaled-height",
|
.generateJsonConfig = (void*) ffGenerateDisplayJsonConfig,
|
||||||
"Screen name - name",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Screen type (builtin, external or unknown) - type",
|
{"Screen configured width (in pixels)", "width"},
|
||||||
"Screen rotation (in degrees) - rotation",
|
{"Screen configured height (in pixels)", "height"},
|
||||||
"True if being the primary screen - is-primary",
|
{"Screen configured refresh rate (in Hz)", "refresh-rate"},
|
||||||
"Screen physical width (in millimeters) - physical-width",
|
{"Screen scaled width (in pixels)", "scaled-width"},
|
||||||
"Screen physical height (in millimeters) - physical-height",
|
{"Screen scaled height (in pixels)", "scaled-height"},
|
||||||
"Physical diagonal length in inches - inch",
|
{"Screen name", "name"},
|
||||||
"Pixels per inch (PPI) - ppi",
|
{"Screen type (builtin, external or unknown)", "type"},
|
||||||
"Bits per color channel - bit-depth",
|
{"Screen rotation (in degrees)", "rotation"},
|
||||||
"True if high dynamic range (HDR) mode is enabled - hdr-enabled",
|
{"True if being the primary screen", "is-primary"},
|
||||||
"Year of manufacturing - manufacture-year",
|
{"Screen physical width (in millimeters)", "physical-width"},
|
||||||
"Nth week of manufacturing in the year - manufacture-week",
|
{"Screen physical height (in millimeters)", "physical-height"},
|
||||||
"Serial number - serial",
|
{"Physical diagonal length in inches", "inch"},
|
||||||
"The platform API used when detecting the display - platform-api",
|
{"Pixels per inch (PPI)", "ppi"},
|
||||||
"True if the display is HDR compatible - hdr-compatible",
|
{"Bits per color channel", "bit-depth"},
|
||||||
"HiDPI scale factor - scale-factor",
|
{"True if high dynamic range (HDR) mode is enabled", "hdr-enabled"},
|
||||||
"Screen preferred width (in pixels) - preferred-width",
|
{"Year of manufacturing", "manufacture-year"},
|
||||||
"Screen preferred height (in pixels) - preferred-height",
|
{"Nth week of manufacturing in the year", "manufacture-week"},
|
||||||
"Screen preferred refresh rate (in Hz) - preferred-refresh-rate",
|
{"Serial number", "serial"},
|
||||||
}));
|
{"The platform API used when detecting the display", "platform-api"},
|
||||||
}
|
{"True if the display is HDR compatible", "hdr-compatible"},
|
||||||
|
{"HiDPI scale factor", "scale-factor"},
|
||||||
|
{"Screen preferred width (in pixels)", "preferred-width"},
|
||||||
|
{"Screen preferred height (in pixels)", "preferred-height"},
|
||||||
|
{"Screen preferred refresh rate (in Hz)", "preferred-refresh-rate"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitDisplayOptions(FFDisplayOptions* options)
|
void ffInitDisplayOptions(FFDisplayOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_DISPLAY_MODULE_NAME,
|
|
||||||
"Print resolutions, refresh rates, etc",
|
|
||||||
ffParseDisplayCommandOptions,
|
|
||||||
ffParseDisplayJsonObject,
|
|
||||||
ffPrintDisplay,
|
|
||||||
ffGenerateDisplayJsonResult,
|
|
||||||
ffPrintDisplayHelpFormat,
|
|
||||||
ffGenerateDisplayJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
|
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
|
||||||
options->preciseRefreshRate = false;
|
options->preciseRefreshRate = false;
|
||||||
|
|||||||
+14
-20
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/dns/dns.h"
|
#include "modules/dns/dns.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_DNS_NUM_FORMAT_ARGS 1
|
|
||||||
|
|
||||||
void ffPrintDNS(FFDNSOptions* options)
|
void ffPrintDNS(FFDNSOptions* options)
|
||||||
{
|
{
|
||||||
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFstrbuf));
|
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFstrbuf));
|
||||||
@@ -48,7 +46,7 @@ void ffPrintDNS(FFDNSOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_DNS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_DNS_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_DNS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(buf, "result"),
|
FF_FORMAT_ARG(buf, "result"),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -166,26 +164,22 @@ exit:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintDNSHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_DNS_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_DNS_MODULE_NAME, "{1}", FF_DNS_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print configured DNS servers",
|
||||||
"DNS result - result",
|
.parseCommandOptions = (void*) ffParseDNSCommandOptions,
|
||||||
}));
|
.parseJsonObject = (void*) ffParseDNSJsonObject,
|
||||||
}
|
.printModule = (void*) ffPrintDNS,
|
||||||
|
.generateJsonResult = (void*) ffGenerateDNSJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateDNSJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"DNS result", "result"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitDNSOptions(FFDNSOptions* options)
|
void ffInitDNSOptions(FFDNSOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_DNS_MODULE_NAME,
|
|
||||||
"Print configured DNS servers",
|
|
||||||
ffParseDNSCommandOptions,
|
|
||||||
ffParseDNSJsonObject,
|
|
||||||
ffPrintDNS,
|
|
||||||
ffGenerateDNSJsonResult,
|
|
||||||
ffPrintDNSHelpFormat,
|
|
||||||
ffGenerateDNSJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->showType = FF_DNS_TYPE_BOTH;
|
options->showType = FF_DNS_TYPE_BOTH;
|
||||||
|
|||||||
+18
-24
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/editor/editor.h"
|
#include "modules/editor/editor.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_EDITOR_NUM_FORMAT_ARGS 5
|
|
||||||
|
|
||||||
void ffPrintEditor(FFEditorOptions* options)
|
void ffPrintEditor(FFEditorOptions* options)
|
||||||
{
|
{
|
||||||
FFEditorResult result = {
|
FFEditorResult result = {
|
||||||
@@ -41,7 +39,7 @@ void ffPrintEditor(FFEditorOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_EDITOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_EDITOR_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_EDITOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result.type, "type"),
|
FF_FORMAT_ARG(result.type, "type"),
|
||||||
FF_FORMAT_ARG(result.name, "name"),
|
FF_FORMAT_ARG(result.name, "name"),
|
||||||
FF_FORMAT_ARG(result.exe, "exe-name"),
|
FF_FORMAT_ARG(result.exe, "exe-name"),
|
||||||
@@ -120,30 +118,26 @@ void ffGenerateEditorJsonResult(FF_MAYBE_UNUSED FFEditorOptions* options, yyjson
|
|||||||
ffStrbufDestroy(&result.version);
|
ffStrbufDestroy(&result.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintEditorHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_EDITOR_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_EDITOR_MODULE_NAME, "{2} ({4})", FF_EDITOR_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print information of the default editor ($VISUAL or $EDITOR)",
|
||||||
"Type (Visual / Editor) - type",
|
.parseCommandOptions = (void*) ffParseEditorCommandOptions,
|
||||||
"Name - name",
|
.parseJsonObject = (void*) ffParseEditorJsonObject,
|
||||||
"Exe name of real path - exe-name",
|
.printModule = (void*) ffPrintEditor,
|
||||||
"Full path of real path - full-path",
|
.generateJsonResult = (void*) ffGenerateEditorJsonResult,
|
||||||
"Version - version",
|
.generateJsonConfig = (void*) ffGenerateEditorJsonConfig,
|
||||||
}));
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}
|
{"Type (Visual / Editor)", "type"},
|
||||||
|
{"Name", "name"},
|
||||||
|
{"Exe name of real path", "exe-name"},
|
||||||
|
{"Full path of real path", "full-path"},
|
||||||
|
{"Version", "version"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitEditorOptions(FFEditorOptions* options)
|
void ffInitEditorOptions(FFEditorOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_EDITOR_MODULE_NAME,
|
|
||||||
"Print information of the default editor ($VISUAL or $EDITOR)",
|
|
||||||
ffParseEditorCommandOptions,
|
|
||||||
ffParseEditorJsonObject,
|
|
||||||
ffPrintEditor,
|
|
||||||
ffGenerateEditorJsonResult,
|
|
||||||
ffPrintEditorHelpFormat,
|
|
||||||
ffGenerateEditorJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-24
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/font/font.h"
|
#include "modules/font/font.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_FONT_NUM_FORMAT_ARGS (FF_DETECT_FONT_NUM_FONTS + 1)
|
|
||||||
|
|
||||||
void ffPrintFont(FFFontOptions* options)
|
void ffPrintFont(FFFontOptions* options)
|
||||||
{
|
{
|
||||||
FFFontResult font;
|
FFFontResult font;
|
||||||
@@ -28,7 +26,7 @@ void ffPrintFont(FFFontOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_FONT_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_FONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(font.fonts[0], "font1"),
|
FF_FORMAT_ARG(font.fonts[0], "font1"),
|
||||||
FF_FORMAT_ARG(font.fonts[1], "font2"),
|
FF_FORMAT_ARG(font.fonts[1], "font2"),
|
||||||
FF_FORMAT_ARG(font.fonts[2], "font3"),
|
FF_FORMAT_ARG(font.fonts[2], "font3"),
|
||||||
@@ -104,30 +102,26 @@ void ffGenerateFontJsonResult(FF_MAYBE_UNUSED FFFontOptions* options, yyjson_mut
|
|||||||
ffStrbufDestroy(&font.fonts[i]);
|
ffStrbufDestroy(&font.fonts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintFontHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_FONT_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_FONT_MODULE_NAME, "{5}", FF_FONT_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print system font names",
|
||||||
"Font 1 - font1",
|
.parseCommandOptions = (void*) ffParseFontCommandOptions,
|
||||||
"Font 2 - font2",
|
.parseJsonObject = (void*) ffParseFontJsonObject,
|
||||||
"Font 3 - font3",
|
.printModule = (void*) ffPrintFont,
|
||||||
"Font 4 - font4",
|
.generateJsonResult = (void*) ffGenerateFontJsonResult,
|
||||||
"Combined fonts for display - combined"
|
.generateJsonConfig = (void*) ffGenerateFontJsonConfig,
|
||||||
}));
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}
|
{"Font 1", "font1"},
|
||||||
|
{"Font 2", "font2"},
|
||||||
|
{"Font 3", "font3"},
|
||||||
|
{"Font 4", "font4"},
|
||||||
|
{"Combined fonts for display", "combined"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitFontOptions(FFFontOptions* options)
|
void ffInitFontOptions(FFFontOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_FONT_MODULE_NAME,
|
|
||||||
"Print system font name",
|
|
||||||
ffParseFontCommandOptions,
|
|
||||||
ffParseFontJsonObject,
|
|
||||||
ffPrintFont,
|
|
||||||
ffGenerateFontJsonResult,
|
|
||||||
ffPrintFontHelpFormat,
|
|
||||||
ffGenerateFontJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/gamepad/gamepad.h"
|
#include "modules/gamepad/gamepad.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_GAMEPAD_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
static void printDevice(FFGamepadOptions* options, const FFGamepadDevice* device, uint8_t index)
|
static void printDevice(FFGamepadOptions* options, const FFGamepadDevice* device, uint8_t index)
|
||||||
{
|
{
|
||||||
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
||||||
@@ -43,7 +41,7 @@ static void printDevice(FFGamepadOptions* options, const FFGamepadDevice* device
|
|||||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||||
ffPercentAppendBar(&percentageBar, device->battery, options->percent, &options->moduleArgs);
|
ffPercentAppendBar(&percentageBar, device->battery, options->percent, &options->moduleArgs);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_GAMEPAD_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GAMEPAD_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_GAMEPAD_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(device->name, "name"),
|
FF_FORMAT_ARG(device->name, "name"),
|
||||||
FF_FORMAT_ARG(device->serial, "serial"),
|
FF_FORMAT_ARG(device->serial, "serial"),
|
||||||
FF_FORMAT_ARG(percentageNum, "battery-percentage"),
|
FF_FORMAT_ARG(percentageNum, "battery-percentage"),
|
||||||
@@ -149,29 +147,25 @@ void ffGenerateGamepadJsonResult(FF_MAYBE_UNUSED FFGamepadOptions* options, yyjs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintGamepadHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_GAMEPAD_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_GAMEPAD_MODULE_NAME, "{1} ({3})", FF_GAMEPAD_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "List (connected) gamepads",
|
||||||
"Name - name",
|
.parseCommandOptions = (void*) ffParseGamepadCommandOptions,
|
||||||
"Serial number - serial",
|
.parseJsonObject = (void*) ffParseGamepadJsonObject,
|
||||||
"Battery percentage num - battery-percentage",
|
.printModule = (void*) ffPrintGamepad,
|
||||||
"Battery percentage bar - battery-percentage-bar",
|
.generateJsonResult = (void*) ffGenerateGamepadJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateGamepadJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Name", "name"},
|
||||||
|
{"Serial number", "serial"},
|
||||||
|
{"Battery percentage num", "battery-percentage"},
|
||||||
|
{"Battery percentage bar", "battery-percentage-bar"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitGamepadOptions(FFGamepadOptions* options)
|
void ffInitGamepadOptions(FFGamepadOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_GAMEPAD_MODULE_NAME,
|
|
||||||
"List connected gamepads",
|
|
||||||
ffParseGamepadCommandOptions,
|
|
||||||
ffParseGamepadJsonObject,
|
|
||||||
ffPrintGamepad,
|
|
||||||
ffGenerateGamepadJsonResult,
|
|
||||||
ffPrintGamepadHelpFormat,
|
|
||||||
ffGenerateGamepadJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-32
@@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define FF_GPU_NUM_FORMAT_ARGS 13
|
|
||||||
|
|
||||||
static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResult* gpu)
|
static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResult* gpu)
|
||||||
{
|
{
|
||||||
const char* type;
|
const char* type;
|
||||||
@@ -90,7 +88,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
|
|||||||
FF_STRBUF_AUTO_DESTROY frequency = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY frequency = ffStrbufCreate();
|
||||||
ffParseFrequency(gpu->frequency, &frequency);
|
ffParseFrequency(gpu->frequency, &frequency);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GPU_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(gpu->vendor, "vendor"),
|
FF_FORMAT_ARG(gpu->vendor, "vendor"),
|
||||||
FF_FORMAT_ARG(gpu->name, "name"),
|
FF_FORMAT_ARG(gpu->name, "name"),
|
||||||
FF_FORMAT_ARG(gpu->driver, "driver"),
|
FF_FORMAT_ARG(gpu->driver, "driver"),
|
||||||
@@ -394,38 +392,34 @@ void ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintGPUHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_GPU_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_GPU_MODULE_NAME, "{1} {2}", FF_GPU_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print GPU names, graphic memory size, type, etc",
|
||||||
"GPU vendor - vendor",
|
.parseCommandOptions = (void*) ffParseGPUCommandOptions,
|
||||||
"GPU name - name",
|
.parseJsonObject = (void*) ffParseGPUJsonObject,
|
||||||
"GPU driver - driver",
|
.printModule = (void*) ffPrintGPU,
|
||||||
"GPU temperature - temperature",
|
.generateJsonResult = (void*) ffGenerateGPUJsonResult,
|
||||||
"GPU core count - core-count",
|
.generateJsonConfig = (void*) ffGenerateGPUJsonConfig,
|
||||||
"GPU type - type",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"GPU total dedicated memory - dedicated-total",
|
{"GPU vendor", "vendor"},
|
||||||
"GPU used dedicated memory - dedicated-used",
|
{"GPU name", "name"},
|
||||||
"GPU total shared memory - shared-total",
|
{"GPU driver", "driver"},
|
||||||
"GPU used shared memory - shared-used",
|
{"GPU temperature", "temperature"},
|
||||||
"The platform API used when detecting the GPU - platform-api",
|
{"GPU core count", "core-count"},
|
||||||
"Current frequency in GHz - frequency",
|
{"GPU type", "type"},
|
||||||
"GPU vendor specific index - index",
|
{"GPU total dedicated memory", "dedicated-total"},
|
||||||
}));
|
{"GPU used dedicated memory", "dedicated-used"},
|
||||||
}
|
{"GPU total shared memory", "shared-total"},
|
||||||
|
{"GPU used shared memory", "shared-used"},
|
||||||
|
{"The platform API used when detecting the GPU", "platform-api"},
|
||||||
|
{"Current frequency in GHz", "frequency"},
|
||||||
|
{"GPU vendor specific index", "index"},
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitGPUOptions(FFGPUOptions* options)
|
void ffInitGPUOptions(FFGPUOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_GPU_MODULE_NAME,
|
|
||||||
"Print GPU names, graphic memory size, type, etc",
|
|
||||||
ffParseGPUCommandOptions,
|
|
||||||
ffParseGPUJsonObject,
|
|
||||||
ffPrintGPU,
|
|
||||||
ffGenerateGPUJsonResult,
|
|
||||||
ffPrintGPUHelpFormat,
|
|
||||||
ffGenerateGPUJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->driverSpecific = false;
|
options->driverSpecific = false;
|
||||||
|
|||||||
+20
-26
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/host/host.h"
|
#include "modules/host/host.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_HOST_NUM_FORMAT_ARGS 7
|
|
||||||
|
|
||||||
void ffPrintHost(FFHostOptions* options)
|
void ffPrintHost(FFHostOptions* options)
|
||||||
{
|
{
|
||||||
FFHostResult host;
|
FFHostResult host;
|
||||||
@@ -48,7 +46,7 @@ void ffPrintHost(FFHostOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_HOST_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_HOST_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_HOST_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(host.family, "family"),
|
FF_FORMAT_ARG(host.family, "family"),
|
||||||
FF_FORMAT_ARG(host.name, "name"),
|
FF_FORMAT_ARG(host.name, "name"),
|
||||||
FF_FORMAT_ARG(host.version, "version"),
|
FF_FORMAT_ARG(host.version, "version"),
|
||||||
@@ -147,32 +145,28 @@ exit:
|
|||||||
ffStrbufDestroy(&host.vendor);
|
ffStrbufDestroy(&host.vendor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintHostHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_HOST_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_HOST_MODULE_NAME, "{2} {3}", FF_HOST_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print product name of your computer",
|
||||||
"product family - family",
|
.parseCommandOptions = (void*) ffParseHostCommandOptions,
|
||||||
"product name - name",
|
.parseJsonObject = (void*) ffParseHostJsonObject,
|
||||||
"product version - version",
|
.printModule = (void*) ffPrintHost,
|
||||||
"product sku - sku",
|
.generateJsonResult = (void*) ffGenerateHostJsonResult,
|
||||||
"product vendor - vendor",
|
.generateJsonConfig = (void*) ffGenerateHostJsonConfig,
|
||||||
"product serial number - serial",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"product uuid - uuid",
|
{"Product family", "family"},
|
||||||
}));
|
{"Product name", "name"},
|
||||||
}
|
{"Product version", "version"},
|
||||||
|
{"Product sku", "sku"},
|
||||||
|
{"Product vendor", "vendor"},
|
||||||
|
{"Product serial number", "serial"},
|
||||||
|
{"Product uuid", "uuid"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitHostOptions(FFHostOptions* options)
|
void ffInitHostOptions(FFHostOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_HOST_MODULE_NAME,
|
|
||||||
"Print product name of your computer",
|
|
||||||
ffParseHostCommandOptions,
|
|
||||||
ffParseHostJsonObject,
|
|
||||||
ffPrintHost,
|
|
||||||
ffGenerateHostJsonResult,
|
|
||||||
ffPrintHostHelpFormat,
|
|
||||||
ffGenerateHostJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-21
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/icons/icons.h"
|
#include "modules/icons/icons.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_ICONS_NUM_FORMAT_ARGS 2
|
|
||||||
|
|
||||||
void ffPrintIcons(FFIconsOptions* options)
|
void ffPrintIcons(FFIconsOptions* options)
|
||||||
{
|
{
|
||||||
FFIconsResult result = {
|
FFIconsResult result = {
|
||||||
@@ -35,7 +33,7 @@ void ffPrintIcons(FFIconsOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_ICONS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_ICONS_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_ICONS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result.icons1, "icons1"),
|
FF_FORMAT_ARG(result.icons1, "icons1"),
|
||||||
FF_FORMAT_ARG(result.icons2, "icons2"),
|
FF_FORMAT_ARG(result.icons2, "icons2"),
|
||||||
}));
|
}));
|
||||||
@@ -102,27 +100,23 @@ void ffGenerateIconsJsonResult(FF_MAYBE_UNUSED FFIconsOptions* options, yyjson_m
|
|||||||
ffStrbufDestroy(&result.icons2);
|
ffStrbufDestroy(&result.icons2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintIconsHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_ICONS_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_ICONS_MODULE_NAME, "{1}, {2}", FF_ICONS_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print icon style name",
|
||||||
"Icons part 1 - icons1",
|
.parseCommandOptions = (void*) ffParseIconsCommandOptions,
|
||||||
"Icons part 2 - icons2",
|
.parseJsonObject = (void*) ffParseIconsJsonObject,
|
||||||
}));
|
.printModule = (void*) ffPrintIcons,
|
||||||
}
|
.generateJsonResult = (void*) ffGenerateIconsJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateIconsJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Icons part 1", "icons1"},
|
||||||
|
{"Icons part 2", "icons2"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitIconsOptions(FFIconsOptions* options)
|
void ffInitIconsOptions(FFIconsOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_ICONS_MODULE_NAME,
|
|
||||||
"Print icon style name",
|
|
||||||
ffParseIconsCommandOptions,
|
|
||||||
ffParseIconsJsonObject,
|
|
||||||
ffPrintIcons,
|
|
||||||
ffGenerateIconsJsonResult,
|
|
||||||
ffPrintIconsHelpFormat,
|
|
||||||
ffGenerateIconsJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "modules/initsystem/initsystem.h"
|
#include "modules/initsystem/initsystem.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_INITSYSTEM_NUM_FORMAT_ARGS 4
|
|
||||||
#define FF_INITSYSTEM_DISPLAY_NAME "Init System"
|
#define FF_INITSYSTEM_DISPLAY_NAME "Init System"
|
||||||
|
|
||||||
void ffPrintInitSystem(FFInitSystemOptions* options)
|
void ffPrintInitSystem(FFInitSystemOptions* options)
|
||||||
@@ -35,7 +34,7 @@ void ffPrintInitSystem(FFInitSystemOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_INITSYSTEM_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_INITSYSTEM_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_INITSYSTEM_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result.name, "name"),
|
FF_FORMAT_ARG(result.name, "name"),
|
||||||
FF_FORMAT_ARG(result.exe, "exe"),
|
FF_FORMAT_ARG(result.exe, "exe"),
|
||||||
FF_FORMAT_ARG(result.version, "version"),
|
FF_FORMAT_ARG(result.version, "version"),
|
||||||
@@ -113,29 +112,25 @@ exit:
|
|||||||
ffStrbufDestroy(&result.version);
|
ffStrbufDestroy(&result.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintInitSystemHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_INITSYSTEM_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_INITSYSTEM_DISPLAY_NAME, "{1}", FF_INITSYSTEM_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print init system (pid 1) name and version",
|
||||||
"init system name - name",
|
.parseCommandOptions = (void*) ffParseInitSystemCommandOptions,
|
||||||
"init system exe path - exe",
|
.parseJsonObject = (void*) ffParseInitSystemJsonObject,
|
||||||
"init system version path - version",
|
.printModule = (void*) ffPrintInitSystem,
|
||||||
"init system pid - pid",
|
.generateJsonResult = (void*) ffGenerateInitSystemJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateInitSystemJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Init system name", "name"},
|
||||||
|
{"Init system exe path", "exe"},
|
||||||
|
{"Init system version path", "version"},
|
||||||
|
{"Init system pid", "pid"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitInitSystemOptions(FFInitSystemOptions* options)
|
void ffInitInitSystemOptions(FFInitSystemOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_INITSYSTEM_MODULE_NAME,
|
|
||||||
"Print init system (pid 1) name and version",
|
|
||||||
ffParseInitSystemCommandOptions,
|
|
||||||
ffParseInitSystemJsonObject,
|
|
||||||
ffPrintInitSystem,
|
|
||||||
ffGenerateInitSystemJsonResult,
|
|
||||||
ffPrintInitSystemHelpFormat,
|
|
||||||
ffGenerateInitSystemJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-25
@@ -3,8 +3,6 @@
|
|||||||
#include "modules/kernel/kernel.h"
|
#include "modules/kernel/kernel.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_KERNEL_NUM_FORMAT_ARGS 6
|
|
||||||
|
|
||||||
void ffPrintKernel(FFKernelOptions* options)
|
void ffPrintKernel(FFKernelOptions* options)
|
||||||
{
|
{
|
||||||
const FFPlatformSysinfo* info = &instance.state.platform.sysinfo;
|
const FFPlatformSysinfo* info = &instance.state.platform.sysinfo;
|
||||||
@@ -22,7 +20,7 @@ void ffPrintKernel(FFKernelOptions* options)
|
|||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
|
||||||
ffParseSize(info->pageSize, &str);
|
ffParseSize(info->pageSize, &str);
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_KERNEL_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_KERNEL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(info->name, "sysname"),
|
FF_FORMAT_ARG(info->name, "sysname"),
|
||||||
FF_FORMAT_ARG(info->release, "release"),
|
FF_FORMAT_ARG(info->release, "release"),
|
||||||
FF_FORMAT_ARG(info->version, "version"),
|
FF_FORMAT_ARG(info->version, "version"),
|
||||||
@@ -81,31 +79,27 @@ void ffGenerateKernelJsonResult(FF_MAYBE_UNUSED FFKernelOptions* options, yyjson
|
|||||||
yyjson_mut_obj_add_uint(doc, obj, "pageSize", info->pageSize);
|
yyjson_mut_obj_add_uint(doc, obj, "pageSize", info->pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintKernelHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_KERNEL_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_KERNEL_MODULE_NAME, "{1} {2}", FF_KERNEL_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print system kernel version",
|
||||||
"Sysname - sysname",
|
.parseCommandOptions = (void*) ffParseKernelCommandOptions,
|
||||||
"Release - release",
|
.parseJsonObject = (void*) ffParseKernelJsonObject,
|
||||||
"Version - version",
|
.printModule = (void*) ffPrintKernel,
|
||||||
"Architecture - arch",
|
.generateJsonResult = (void*) ffGenerateKernelJsonResult,
|
||||||
"Display version - display-version",
|
.generateJsonConfig = (void*) ffGenerateKernelJsonConfig,
|
||||||
"Page size - page-size",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}));
|
{"Sysname", "sysname"},
|
||||||
}
|
{"Release", "release"},
|
||||||
|
{"Version", "version"},
|
||||||
|
{"Architecture", "arch"},
|
||||||
|
{"Display version", "display-version"},
|
||||||
|
{"Page size", "page-size"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitKernelOptions(FFKernelOptions* options)
|
void ffInitKernelOptions(FFKernelOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_KERNEL_MODULE_NAME,
|
|
||||||
"Print system kernel version",
|
|
||||||
ffParseKernelCommandOptions,
|
|
||||||
ffParseKernelJsonObject,
|
|
||||||
ffPrintKernel,
|
|
||||||
ffGenerateKernelJsonResult,
|
|
||||||
ffPrintKernelHelpFormat,
|
|
||||||
ffGenerateKernelJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/keyboard/keyboard.h"
|
#include "modules/keyboard/keyboard.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_KEYBOARD_NUM_FORMAT_ARGS 2
|
|
||||||
|
|
||||||
static void printDevice(FFKeyboardOptions* options, const FFKeyboardDevice* device, uint8_t index)
|
static void printDevice(FFKeyboardOptions* options, const FFKeyboardDevice* device, uint8_t index)
|
||||||
{
|
{
|
||||||
if(options->moduleArgs.outputFormat.length == 0)
|
if(options->moduleArgs.outputFormat.length == 0)
|
||||||
@@ -16,7 +14,7 @@ static void printDevice(FFKeyboardOptions* options, const FFKeyboardDevice* devi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_KEYBOARD_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_KEYBOARD_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_KEYBOARD_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(device->name, "name"),
|
FF_FORMAT_ARG(device->name, "name"),
|
||||||
FF_FORMAT_ARG(device->serial, "serial"),
|
FF_FORMAT_ARG(device->serial, "serial"),
|
||||||
}));
|
}));
|
||||||
@@ -112,27 +110,23 @@ void ffGenerateKeyboardJsonResult(FF_MAYBE_UNUSED FFKeyboardOptions* options, yy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintKeyboardHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_KEYBOARD_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_KEYBOARD_MODULE_NAME, "{1} ({3})", FF_KEYBOARD_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "List (connected) keyboards",
|
||||||
"Name - name",
|
.parseCommandOptions = (void*) ffParseKeyboardCommandOptions,
|
||||||
"Serial number - serial",
|
.parseJsonObject = (void*) ffParseKeyboardJsonObject,
|
||||||
}));
|
.printModule = (void*) ffPrintKeyboard,
|
||||||
}
|
.generateJsonResult = (void*) ffGenerateKeyboardJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateKeyboardJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Name", "name"},
|
||||||
|
{"Serial number", "serial"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitKeyboardOptions(FFKeyboardOptions* options)
|
void ffInitKeyboardOptions(FFKeyboardOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_KEYBOARD_MODULE_NAME,
|
|
||||||
"List connected keyboards",
|
|
||||||
ffParseKeyboardCommandOptions,
|
|
||||||
ffParseKeyboardJsonObject,
|
|
||||||
ffPrintKeyboard,
|
|
||||||
ffGenerateKeyboardJsonResult,
|
|
||||||
ffPrintKeyboardHelpFormat,
|
|
||||||
ffGenerateKeyboardJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-22
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/lm/lm.h"
|
#include "modules/lm/lm.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_LM_NUM_FORMAT_ARGS 3
|
|
||||||
|
|
||||||
void ffPrintLM(FFLMOptions* options)
|
void ffPrintLM(FFLMOptions* options)
|
||||||
{
|
{
|
||||||
FFLMResult result;
|
FFLMResult result;
|
||||||
@@ -38,7 +36,7 @@ void ffPrintLM(FFLMOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LM_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result.service, "service"),
|
FF_FORMAT_ARG(result.service, "service"),
|
||||||
FF_FORMAT_ARG(result.type, "type"),
|
FF_FORMAT_ARG(result.type, "type"),
|
||||||
FF_FORMAT_ARG(result.version, "version"),
|
FF_FORMAT_ARG(result.version, "version"),
|
||||||
@@ -115,28 +113,24 @@ exit:
|
|||||||
ffStrbufDestroy(&result.version);
|
ffStrbufDestroy(&result.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintLMHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_LM_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_LM_MODULE_NAME, "{1} {3} ({2})", FF_LM_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print login manager (desktop manager) name and version",
|
||||||
"LM service - service",
|
.parseCommandOptions = (void*) ffParseLMCommandOptions,
|
||||||
"LM type - type",
|
.parseJsonObject = (void*) ffParseLMJsonObject,
|
||||||
"LM version - version"
|
.printModule = (void*) ffPrintLM,
|
||||||
}));
|
.generateJsonResult = (void*) ffGenerateLMJsonResult,
|
||||||
}
|
.generateJsonConfig = (void*) ffGenerateLMJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"LM service", "service"},
|
||||||
|
{"LM type", "type"},
|
||||||
|
{"LM version", "version"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitLMOptions(FFLMOptions* options)
|
void ffInitLMOptions(FFLMOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_LM_MODULE_NAME,
|
|
||||||
"Print login manager (desktop manager) name and version",
|
|
||||||
ffParseLMCommandOptions,
|
|
||||||
ffParseLMJsonObject,
|
|
||||||
ffPrintLM,
|
|
||||||
ffGenerateLMJsonResult,
|
|
||||||
ffPrintLMHelpFormat,
|
|
||||||
ffGenerateLMJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
#include "modules/loadavg/loadavg.h"
|
#include "modules/loadavg/loadavg.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_LOADAVG_NUM_FORMAT_ARGS 3
|
|
||||||
|
|
||||||
void ffPrintLoadavg(FFLoadavgOptions* options)
|
void ffPrintLoadavg(FFLoadavgOptions* options)
|
||||||
{
|
{
|
||||||
double result[3] = { 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0 };
|
double result[3] = { 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0 };
|
||||||
@@ -48,7 +46,7 @@ void ffPrintLoadavg(FFLoadavgOptions* options)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ffStrbufClear(&buffer);
|
ffStrbufClear(&buffer);
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&buffer, &options->moduleArgs.key, 3, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&buffer, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(duration, "duration"),
|
FF_FORMAT_ARG(duration, "duration"),
|
||||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||||
@@ -84,7 +82,7 @@ void ffPrintLoadavg(FFLoadavgOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_LOADAVG_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LOADAVG_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_LOADAVG_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result[0], "loadavg1"),
|
FF_FORMAT_ARG(result[0], "loadavg1"),
|
||||||
FF_FORMAT_ARG(result[1], "loadavg2"),
|
FF_FORMAT_ARG(result[1], "loadavg2"),
|
||||||
FF_FORMAT_ARG(result[2], "loadavg3"),
|
FF_FORMAT_ARG(result[2], "loadavg3"),
|
||||||
@@ -181,28 +179,24 @@ void ffGenerateLoadavgJsonResult(FF_MAYBE_UNUSED FFLoadavgOptions* options, yyjs
|
|||||||
yyjson_mut_arr_add_real(doc, arr, result[i]);
|
yyjson_mut_arr_add_real(doc, arr, result[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintLoadavgHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_LOADAVG_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_LOADAVG_MODULE_NAME, "{1}, {2}, {3}", FF_LOADAVG_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print system load averages",
|
||||||
"Load average over 1min - loadavg1",
|
.parseCommandOptions = (void*) ffParseLoadavgCommandOptions,
|
||||||
"Load average over 5min - loadavg2",
|
.parseJsonObject = (void*) ffParseLoadavgJsonObject,
|
||||||
"Load average over 15min - loadavg3",
|
.printModule = (void*) ffPrintLoadavg,
|
||||||
}));
|
.generateJsonResult = (void*) ffGenerateLoadavgJsonResult,
|
||||||
}
|
.generateJsonConfig = (void*) ffGenerateLoadavgJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Load average over 1min", "loadavg1"},
|
||||||
|
{"Load average over 5min", "loadavg2"},
|
||||||
|
{"Load average over 15min", "loadavg3"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitLoadavgOptions(FFLoadavgOptions* options)
|
void ffInitLoadavgOptions(FFLoadavgOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_LOADAVG_MODULE_NAME,
|
|
||||||
"Print system load averages",
|
|
||||||
ffParseLoadavgCommandOptions,
|
|
||||||
ffParseLoadavgJsonObject,
|
|
||||||
ffPrintLoadavg,
|
|
||||||
ffGenerateLoadavgJsonResult,
|
|
||||||
ffPrintLoadavgHelpFormat,
|
|
||||||
ffGenerateLoadavgJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||||
|
|||||||
+14
-20
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/locale/locale.h"
|
#include "modules/locale/locale.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_LOCALE_NUM_FORMAT_ARGS 1
|
|
||||||
|
|
||||||
void ffPrintLocale(FFLocaleOptions* options)
|
void ffPrintLocale(FFLocaleOptions* options)
|
||||||
{
|
{
|
||||||
FF_STRBUF_AUTO_DESTROY locale = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY locale = ffStrbufCreate();
|
||||||
@@ -24,7 +22,7 @@ void ffPrintLocale(FFLocaleOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_LOCALE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_LOCALE_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_LOCALE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(locale, "result")
|
FF_FORMAT_ARG(locale, "result")
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -79,26 +77,22 @@ void ffGenerateLocaleJsonResult(FF_MAYBE_UNUSED FFLocaleOptions* options, yyjson
|
|||||||
yyjson_mut_obj_add_strbuf(doc, module, "result", &locale);
|
yyjson_mut_obj_add_strbuf(doc, module, "result", &locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintLocaleHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_LOCALE_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_LOCALE_MODULE_NAME, "{1}", FF_LOCALE_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print system locale name",
|
||||||
"Locale code - result"
|
.parseCommandOptions = (void*) ffParseLocaleCommandOptions,
|
||||||
}));
|
.parseJsonObject = (void*) ffParseLocaleJsonObject,
|
||||||
}
|
.printModule = (void*) ffPrintLocale,
|
||||||
|
.generateJsonResult = (void*) ffGenerateLocaleJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateLocaleJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Locale code", "result"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitLocaleOptions(FFLocaleOptions* options)
|
void ffInitLocaleOptions(FFLocaleOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_LOCALE_MODULE_NAME,
|
|
||||||
"Print system locale name",
|
|
||||||
ffParseLocaleCommandOptions,
|
|
||||||
ffParseLocaleJsonObject,
|
|
||||||
ffPrintLocale,
|
|
||||||
ffGenerateLocaleJsonResult,
|
|
||||||
ffPrintLocaleHelpFormat,
|
|
||||||
ffGenerateLocaleJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_LOCALIP_DISPLAY_NAME "Local IP"
|
#define FF_LOCALIP_DISPLAY_NAME "Local IP"
|
||||||
#define FF_LOCALIP_NUM_FORMAT_ARGS 8
|
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
|
|
||||||
static int sortIps(const FFLocalIpResult* left, const FFLocalIpResult* right)
|
static int sortIps(const FFLocalIpResult* left, const FFLocalIpResult* right)
|
||||||
@@ -25,7 +24,7 @@ static void formatKey(const FFLocalIpOptions* options, FFLocalIpResult* ip, uint
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ffStrbufClear(key);
|
ffStrbufClear(key);
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 4, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(ip->name, "name"),
|
FF_FORMAT_ARG(ip->name, "name"),
|
||||||
FF_FORMAT_ARG(ip->mac, "mac"),
|
FF_FORMAT_ARG(ip->mac, "mac"),
|
||||||
@@ -149,7 +148,7 @@ void ffPrintLocalIp(FFLocalIpOptions* options)
|
|||||||
else
|
else
|
||||||
ffStrbufSetF(&speedStr, "%u Mbps", (unsigned) ip->speed);
|
ffStrbufSetF(&speedStr, "%u Mbps", (unsigned) ip->speed);
|
||||||
}
|
}
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_LOCALIP_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(ip->ipv4, "ipv4"),
|
FF_FORMAT_ARG(ip->ipv4, "ipv4"),
|
||||||
FF_FORMAT_ARG(ip->ipv6, "ipv6"),
|
FF_FORMAT_ARG(ip->ipv6, "ipv6"),
|
||||||
FF_FORMAT_ARG(ip->mac, "mac"),
|
FF_FORMAT_ARG(ip->mac, "mac"),
|
||||||
@@ -500,33 +499,29 @@ void ffGenerateLocalIpJsonResult(FF_MAYBE_UNUSED FFLocalIpOptions* options, yyjs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintLocalIpHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_LOCALIP_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_LOCALIP_MODULE_NAME, "{1}", FF_LOCALIP_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "List local IP addresses (v4 or v6), MAC addresses, etc",
|
||||||
"Local IPv4 address - ipv4",
|
.parseCommandOptions = (void*) ffParseLocalIpCommandOptions,
|
||||||
"Local IPv6 address - ipv6",
|
.parseJsonObject = (void*) ffParseLocalIpJsonObject,
|
||||||
"Physical (MAC) address - mac",
|
.printModule = (void*) ffPrintLocalIp,
|
||||||
"Interface name - ifname",
|
.generateJsonResult = (void*) ffGenerateLocalIpJsonResult,
|
||||||
"Is default route - is-default-route",
|
.generateJsonConfig = (void*) ffGenerateLocalIpJsonConfig,
|
||||||
"MTU size in bytes - mtu",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Link speed (formatted) - speed",
|
{"IPv4 address", "ipv4"},
|
||||||
"Interface flags - flags",
|
{"IPv6 address", "ipv6"},
|
||||||
}));
|
{"MAC address", "mac"},
|
||||||
}
|
{"Interface name", "ifname"},
|
||||||
|
{"Is default route", "is-default-route"},
|
||||||
|
{"MTU size in bytes", "mtu"},
|
||||||
|
{"Link speed (formatted)", "speed"},
|
||||||
|
{"Interface flags", "flags"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitLocalIpOptions(FFLocalIpOptions* options)
|
void ffInitLocalIpOptions(FFLocalIpOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_LOCALIP_MODULE_NAME,
|
|
||||||
"List local IP addresses (v4 or v6), MAC addresses, etc",
|
|
||||||
ffParseLocalIpCommandOptions,
|
|
||||||
ffParseLocalIpJsonObject,
|
|
||||||
ffPrintLocalIp,
|
|
||||||
ffGenerateLocalIpJsonResult,
|
|
||||||
ffPrintLocalIpHelpFormat,
|
|
||||||
ffGenerateLocalIpJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->showType = FF_LOCALIP_TYPE_IPV4_BIT | FF_LOCALIP_TYPE_PREFIX_LEN_BIT
|
options->showType = FF_LOCALIP_TYPE_IPV4_BIT | FF_LOCALIP_TYPE_PREFIX_LEN_BIT
|
||||||
|
|||||||
+18
-24
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#define FF_MEDIA_NUM_FORMAT_ARGS 5
|
|
||||||
|
|
||||||
static inline bool shouldIgnoreChar(char c)
|
static inline bool shouldIgnoreChar(char c)
|
||||||
{
|
{
|
||||||
return isblank(c) || c == '-' || c == '.';
|
return isblank(c) || c == '-' || c == '.';
|
||||||
@@ -95,7 +93,7 @@ void ffPrintMedia(FFMediaOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_MEDIA_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MEDIA_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_MEDIA_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(songPretty, "combined"),
|
FF_FORMAT_ARG(songPretty, "combined"),
|
||||||
FF_FORMAT_ARG(media->song, "title"),
|
FF_FORMAT_ARG(media->song, "title"),
|
||||||
FF_FORMAT_ARG(media->artist, "artist"),
|
FF_FORMAT_ARG(media->artist, "artist"),
|
||||||
@@ -157,30 +155,26 @@ void ffGenerateMediaJsonResult(FF_MAYBE_UNUSED FFMediaOptions* options, yyjson_m
|
|||||||
yyjson_mut_obj_add_strbuf(doc, obj, "status", &media->status);
|
yyjson_mut_obj_add_strbuf(doc, obj, "status", &media->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintMediaHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_MEDIA_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_MEDIA_MODULE_NAME, "{3} - {1} ({5})", FF_MEDIA_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print playing song name",
|
||||||
"Pretty media name - combined",
|
.parseCommandOptions = (void*) ffParseMediaCommandOptions,
|
||||||
"Media name - title",
|
.parseJsonObject = (void*) ffParseMediaJsonObject,
|
||||||
"Artist name - artist",
|
.printModule = (void*) ffPrintMedia,
|
||||||
"Album name - album",
|
.generateJsonResult = (void*) ffGenerateMediaJsonResult,
|
||||||
"Status - status",
|
.generateJsonConfig = (void*) ffGenerateMediaJsonConfig,
|
||||||
}));
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}
|
{"Pretty media name", "combined"},
|
||||||
|
{"Media name", "title"},
|
||||||
|
{"Artist name", "artist"},
|
||||||
|
{"Album name", "album"},
|
||||||
|
{"Status", "status"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitMediaOptions(FFMediaOptions* options)
|
void ffInitMediaOptions(FFMediaOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_MEDIA_MODULE_NAME,
|
|
||||||
"Print playing song name",
|
|
||||||
ffParseMediaCommandOptions,
|
|
||||||
ffParseMediaJsonObject,
|
|
||||||
ffPrintMedia,
|
|
||||||
ffGenerateMediaJsonResult,
|
|
||||||
ffPrintMediaHelpFormat,
|
|
||||||
ffGenerateMediaJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-23
@@ -6,8 +6,6 @@
|
|||||||
#include "modules/memory/memory.h"
|
#include "modules/memory/memory.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_MEMORY_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintMemory(FFMemoryOptions* options)
|
void ffPrintMemory(FFMemoryOptions* options)
|
||||||
{
|
{
|
||||||
FFMemoryResult storage = {};
|
FFMemoryResult storage = {};
|
||||||
@@ -64,7 +62,7 @@ void ffPrintMemory(FFMemoryOptions* options)
|
|||||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||||
ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs);
|
ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(usedPretty, "used"),
|
FF_FORMAT_ARG(usedPretty, "used"),
|
||||||
FF_FORMAT_ARG(totalPretty, "total"),
|
FF_FORMAT_ARG(totalPretty, "total"),
|
||||||
FF_FORMAT_ARG(percentageNum, "percentage"),
|
FF_FORMAT_ARG(percentageNum, "percentage"),
|
||||||
@@ -132,29 +130,25 @@ void ffGenerateMemoryJsonResult(FF_MAYBE_UNUSED FFMemoryOptions* options, yyjson
|
|||||||
yyjson_mut_obj_add_uint(doc, obj, "used", storage.bytesUsed);
|
yyjson_mut_obj_add_uint(doc, obj, "used", storage.bytesUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintMemoryHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_MEMORY_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_MEMORY_MODULE_NAME, "{1} / {2} ({3})", FF_MEMORY_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print system memory usage info",
|
||||||
"Used size - used",
|
.parseCommandOptions = (void*) ffParseMemoryCommandOptions,
|
||||||
"Total size - total",
|
.parseJsonObject = (void*) ffParseMemoryJsonObject,
|
||||||
"Percentage used (num) - percentage",
|
.printModule = (void*) ffPrintMemory,
|
||||||
"Percentage used (bar) - percentage-bar",
|
.generateJsonResult = (void*) ffGenerateMemoryJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateMemoryJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Used size", "used"},
|
||||||
|
{"Total size", "total"},
|
||||||
|
{"Percentage used (num)", "percentage"},
|
||||||
|
{"Percentage used (bar)", "percentage-bar"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitMemoryOptions(FFMemoryOptions* options)
|
void ffInitMemoryOptions(FFMemoryOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_MEMORY_MODULE_NAME,
|
|
||||||
"Print system memory usage info",
|
|
||||||
ffParseMemoryCommandOptions,
|
|
||||||
ffParseMemoryJsonObject,
|
|
||||||
ffPrintMemory,
|
|
||||||
ffGenerateMemoryJsonResult,
|
|
||||||
ffPrintMemoryHelpFormat,
|
|
||||||
ffGenerateMemoryJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define FF_MONITOR_NUM_FORMAT_ARGS 12
|
|
||||||
|
|
||||||
void ffPrintMonitor(FFMonitorOptions* options)
|
void ffPrintMonitor(FFMonitorOptions* options)
|
||||||
{
|
{
|
||||||
const FFDisplayServerResult* result = ffConnectDisplayServer();
|
const FFDisplayServerResult* result = ffConnectDisplayServer();
|
||||||
@@ -36,7 +34,7 @@ void ffPrintMonitor(FFMonitorOptions* options)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t moduleIndex = result->displays.length == 1 ? 0 : index + 1;
|
uint32_t moduleIndex = result->displays.length == 1 ? 0 : index + 1;
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, 3, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(moduleIndex, "index"),
|
FF_FORMAT_ARG(moduleIndex, "index"),
|
||||||
FF_FORMAT_ARG(display->name, "name"),
|
FF_FORMAT_ARG(display->name, "name"),
|
||||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||||
@@ -67,7 +65,7 @@ void ffPrintMonitor(FFMonitorOptions* options)
|
|||||||
else
|
else
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_MONITOR_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(display->name, "name"),
|
FF_FORMAT_ARG(display->name, "name"),
|
||||||
FF_FORMAT_ARG(display->width, "width"),
|
FF_FORMAT_ARG(display->width, "width"),
|
||||||
FF_FORMAT_ARG(display->height, "height"),
|
FF_FORMAT_ARG(display->height, "height"),
|
||||||
@@ -128,37 +126,33 @@ void ffGenerateMonitorJsonResult(FF_MAYBE_UNUSED FFMonitorOptions* options, yyjs
|
|||||||
yyjson_mut_obj_add_str(doc, module, "error", "Monitor module is an alias of Display module");
|
yyjson_mut_obj_add_str(doc, module, "error", "Monitor module is an alias of Display module");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintMonitorHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_MONITOR_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_MONITOR_MODULE_NAME, "{2}x{3} px - {4}x{5} mm ({6} inches, {7} ppi)", FF_MONITOR_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Alias of Display module",
|
||||||
"Display name - name",
|
.parseCommandOptions = (void*) ffParseMonitorCommandOptions,
|
||||||
"Native resolution width in pixels - width",
|
.parseJsonObject = (void*) ffParseMonitorJsonObject,
|
||||||
"Native resolution height in pixels - height",
|
.printModule = (void*) ffPrintMonitor,
|
||||||
"Physical width in millimeters - physical-width",
|
.generateJsonResult = (void*) ffGenerateMonitorJsonResult,
|
||||||
"Physical height in millimeters - physical-height",
|
.generateJsonConfig = (void*) ffGenerateMonitorJsonConfig,
|
||||||
"Physical diagonal length in inches - inch",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Pixels per inch (PPI) - ppi",
|
{"Display name", "name"},
|
||||||
"Year of manufacturing - manufacture-year",
|
{"Native resolution width in pixels", "width"},
|
||||||
"Nth week of manufacturing in the year - manufacture-week",
|
{"Native resolution height in pixels", "height"},
|
||||||
"Serial number - serial",
|
{"Physical width in millimeters", "physical-width"},
|
||||||
"Maximum refresh rate in Hz - refresh-rate",
|
{"Physical height in millimeters", "physical-height"},
|
||||||
"True if the display is HDR compatible - hdr-compatible",
|
{"Physical diagonal length in inches", "inch"},
|
||||||
}));
|
{"Pixels per inch (PPI)", "ppi"},
|
||||||
}
|
{"Year of manufacturing", "manufacture-year"},
|
||||||
|
{"Nth week of manufacturing in the year", "manufacture-week"},
|
||||||
|
{"Serial number", "serial"},
|
||||||
|
{"Maximum refresh rate in Hz", "refresh-rate"},
|
||||||
|
{"True if the display is HDR compatible", "hdr-compatible"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitMonitorOptions(FFMonitorOptions* options)
|
void ffInitMonitorOptions(FFMonitorOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_MONITOR_MODULE_NAME,
|
|
||||||
"Alias of Display module",
|
|
||||||
ffParseMonitorCommandOptions,
|
|
||||||
ffParseMonitorJsonObject,
|
|
||||||
ffPrintMonitor,
|
|
||||||
ffGenerateMonitorJsonResult,
|
|
||||||
ffPrintMonitorHelpFormat,
|
|
||||||
ffGenerateMonitorJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-21
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/mouse/mouse.h"
|
#include "modules/mouse/mouse.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_MOUSE_NUM_FORMAT_ARGS 2
|
|
||||||
|
|
||||||
static void printDevice(FFMouseOptions* options, const FFMouseDevice* device, uint8_t index)
|
static void printDevice(FFMouseOptions* options, const FFMouseDevice* device, uint8_t index)
|
||||||
{
|
{
|
||||||
if(options->moduleArgs.outputFormat.length == 0)
|
if(options->moduleArgs.outputFormat.length == 0)
|
||||||
@@ -16,7 +14,7 @@ static void printDevice(FFMouseOptions* options, const FFMouseDevice* device, ui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_MOUSE_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MOUSE_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_MOUSE_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(device->name, "name"),
|
FF_FORMAT_ARG(device->name, "name"),
|
||||||
FF_FORMAT_ARG(device->serial, "serial"),
|
FF_FORMAT_ARG(device->serial, "serial"),
|
||||||
}));
|
}));
|
||||||
@@ -112,27 +110,23 @@ void ffGenerateMouseJsonResult(FF_MAYBE_UNUSED FFMouseOptions* options, yyjson_m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintMouseHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_MOUSE_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_MOUSE_MODULE_NAME, "{1} ({3})", FF_MOUSE_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "List connected mouses",
|
||||||
"Name - name",
|
.parseCommandOptions = (void*) ffParseMouseCommandOptions,
|
||||||
"Serial number - serial",
|
.parseJsonObject = (void*) ffParseMouseJsonObject,
|
||||||
}));
|
.printModule = (void*) ffPrintMouse,
|
||||||
}
|
.generateJsonResult = (void*) ffGenerateMouseJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateMouseJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Mouse name", "name"},
|
||||||
|
{"Mouse serial number", "serial"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitMouseOptions(FFMouseOptions* options)
|
void ffInitMouseOptions(FFMouseOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_MOUSE_MODULE_NAME,
|
|
||||||
"List connected mouses",
|
|
||||||
ffParseMouseCommandOptions,
|
|
||||||
ffParseMouseJsonObject,
|
|
||||||
ffPrintMouse,
|
|
||||||
ffGenerateMouseJsonResult,
|
|
||||||
ffPrintMouseHelpFormat,
|
|
||||||
ffGenerateMouseJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+26
-31
@@ -6,7 +6,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_NETIO_DISPLAY_NAME "Network IO"
|
#define FF_NETIO_DISPLAY_NAME "Network IO"
|
||||||
#define FF_NETIO_NUM_FORMAT_ARGS 12
|
|
||||||
|
|
||||||
static int sortInfs(const FFNetIOResult* left, const FFNetIOResult* right)
|
static int sortInfs(const FFNetIOResult* left, const FFNetIOResult* right)
|
||||||
{
|
{
|
||||||
@@ -25,7 +24,7 @@ static void formatKey(const FFNetIOOptions* options, FFNetIOResult* inf, uint32_
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ffStrbufClear(key);
|
ffStrbufClear(key);
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 3, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(inf->name, "name"),
|
FF_FORMAT_ARG(inf->name, "name"),
|
||||||
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
|
||||||
@@ -80,7 +79,7 @@ void ffPrintNetIO(FFNetIOOptions* options)
|
|||||||
ffParseSize(inf->txBytes, &buffer2);
|
ffParseSize(inf->txBytes, &buffer2);
|
||||||
if (!options->detectTotal) ffStrbufAppendS(&buffer2, "/s");
|
if (!options->detectTotal) ffStrbufAppendS(&buffer2, "/s");
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_NETIO_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(buffer, "rx-size"),
|
FF_FORMAT_ARG(buffer, "rx-size"),
|
||||||
FF_FORMAT_ARG(buffer2, "tx-size"),
|
FF_FORMAT_ARG(buffer2, "tx-size"),
|
||||||
FF_FORMAT_ARG(inf->name, "ifname"),
|
FF_FORMAT_ARG(inf->name, "ifname"),
|
||||||
@@ -229,37 +228,33 @@ void ffGenerateNetIOJsonResult(FFNetIOOptions* options, yyjson_mut_doc* doc, yyj
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintNetIOHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_NETIO_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_NETIO_MODULE_NAME, "{1} (IN) - {2} (OUT)", FF_NETIO_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print network I/O throughput",
|
||||||
"Size of data received [per second] (formatted) - rx-size",
|
.parseCommandOptions = (void*) ffParseNetIOCommandOptions,
|
||||||
"Size of data sent [per second] (formatted) - tx-size",
|
.parseJsonObject = (void*) ffParseNetIOJsonObject,
|
||||||
"Interface name - ifname",
|
.printModule = (void*) ffPrintNetIO,
|
||||||
"Is default route - is-default-route",
|
.generateJsonResult = (void*) ffGenerateNetIOJsonResult,
|
||||||
"Size of data received [per second] (in bytes) - rx-bytes",
|
.generateJsonConfig = (void*) ffGenerateNetIOJsonConfig,
|
||||||
"Size of data sent [per second] (in bytes) - tx-bytes",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Number of packets received [per second] - rx-packets",
|
{"Size of data received [per second] (formatted)", "rx-size"},
|
||||||
"Number of packets sent [per second] - tx-packets",
|
{"Size of data sent [per second] (formatted)", "tx-size"},
|
||||||
"Number of errors received [per second] - rx-errors",
|
{"Interface name", "ifname"},
|
||||||
"Number of errors sent [per second] - tx-errors",
|
{"Is default route", "is-default-route"},
|
||||||
"Number of packets dropped when receiving [per second] - rx-drops",
|
{"Size of data received [per second] (in bytes)", "rx-bytes"},
|
||||||
"Number of packets dropped when sending [per second] - tx-drops",
|
{"Size of data sent [per second] (in bytes)", "tx-bytes"},
|
||||||
}));
|
{"Number of packets received [per second]", "rx-packets"},
|
||||||
}
|
{"Number of packets sent [per second]", "tx-packets"},
|
||||||
|
{"Number of errors received [per second]", "rx-errors"},
|
||||||
|
{"Number of errors sent [per second]", "tx-errors"},
|
||||||
|
{"Number of packets dropped when receiving [per second]", "rx-drops"},
|
||||||
|
{"Number of packets dropped when sending [per second]", "tx-drops"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitNetIOOptions(FFNetIOOptions* options)
|
void ffInitNetIOOptions(FFNetIOOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_NETIO_MODULE_NAME,
|
|
||||||
"Print network I/O throughput",
|
|
||||||
ffParseNetIOCommandOptions,
|
|
||||||
ffParseNetIOJsonObject,
|
|
||||||
ffPrintNetIO,
|
|
||||||
ffGenerateNetIOJsonResult,
|
|
||||||
ffPrintNetIOHelpFormat,
|
|
||||||
ffGenerateNetIOJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
ffStrbufInit(&options->namePrefix);
|
ffStrbufInit(&options->namePrefix);
|
||||||
|
|||||||
+16
-22
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/opencl/opencl.h"
|
#include "modules/opencl/opencl.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_OPENCL_NUM_FORMAT_ARGS 3
|
|
||||||
|
|
||||||
void ffPrintOpenCL(FFOpenCLOptions* options)
|
void ffPrintOpenCL(FFOpenCLOptions* options)
|
||||||
{
|
{
|
||||||
FFOpenCLResult* result = ffDetectOpenCL();
|
FFOpenCLResult* result = ffDetectOpenCL();
|
||||||
@@ -24,7 +22,7 @@ void ffPrintOpenCL(FFOpenCLOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_OPENCL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OPENCL_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_OPENCL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result->version, "version"),
|
FF_FORMAT_ARG(result->version, "version"),
|
||||||
FF_FORMAT_ARG(result->name, "name"),
|
FF_FORMAT_ARG(result->name, "name"),
|
||||||
FF_FORMAT_ARG(result->vendor, "vendor"),
|
FF_FORMAT_ARG(result->vendor, "vendor"),
|
||||||
@@ -130,28 +128,24 @@ void ffGenerateOpenCLJsonResult(FF_MAYBE_UNUSED FFOpenCLOptions* options, yyjson
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintOpenCLHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_OPENCL_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_OPENCL_MODULE_NAME, "{1}", FF_OPENCL_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print highest OpenCL version supported by the GPU",
|
||||||
"Platform version - version",
|
.parseCommandOptions = (void*) ffParseOpenCLCommandOptions,
|
||||||
"Platform name - name",
|
.parseJsonObject = (void*) ffParseOpenCLJsonObject,
|
||||||
"Platform vendor - vendor",
|
.printModule = (void*) ffPrintOpenCL,
|
||||||
}));
|
.generateJsonResult = (void*) ffGenerateOpenCLJsonResult,
|
||||||
}
|
.generateJsonConfig = (void*) ffGenerateOpenCLJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Platform version", "version"},
|
||||||
|
{"Platform name", "name"},
|
||||||
|
{"Platform vendor", "vendor"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitOpenCLOptions(FFOpenCLOptions* options)
|
void ffInitOpenCLOptions(FFOpenCLOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_OPENCL_MODULE_NAME,
|
|
||||||
"Print highest OpenCL version supported by the GPU",
|
|
||||||
ffParseOpenCLCommandOptions,
|
|
||||||
ffParseOpenCLJsonObject,
|
|
||||||
ffPrintOpenCL,
|
|
||||||
ffGenerateOpenCLJsonResult,
|
|
||||||
ffPrintOpenCLHelpFormat,
|
|
||||||
ffGenerateOpenCLJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-24
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/opengl/opengl.h"
|
#include "modules/opengl/opengl.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_OPENGL_NUM_FORMAT_ARGS 5
|
|
||||||
|
|
||||||
void ffPrintOpenGL(FFOpenGLOptions* options)
|
void ffPrintOpenGL(FFOpenGLOptions* options)
|
||||||
{
|
{
|
||||||
FFOpenGLResult result;
|
FFOpenGLResult result;
|
||||||
@@ -29,7 +27,7 @@ void ffPrintOpenGL(FFOpenGLOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_OPENGL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OPENGL_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_OPENGL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result.version, "version"),
|
FF_FORMAT_ARG(result.version, "version"),
|
||||||
FF_FORMAT_ARG(result.renderer, "renderer"),
|
FF_FORMAT_ARG(result.renderer, "renderer"),
|
||||||
FF_FORMAT_ARG(result.vendor, "vendor"),
|
FF_FORMAT_ARG(result.vendor, "vendor"),
|
||||||
@@ -159,30 +157,26 @@ void ffGenerateOpenGLJsonResult(FF_MAYBE_UNUSED FFOpenGLOptions* options, yyjson
|
|||||||
ffStrbufDestroy(&result.library);
|
ffStrbufDestroy(&result.library);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintOpenGLHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_OPENGL_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_OPENGL_MODULE_NAME, "{1}", FF_OPENGL_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print highest OpenGL version supported by the GPU",
|
||||||
"version - version",
|
.parseCommandOptions = (void*) ffParseOpenGLCommandOptions,
|
||||||
"renderer - renderer",
|
.parseJsonObject = (void*) ffParseOpenGLJsonObject,
|
||||||
"vendor - vendor",
|
.printModule = (void*) ffPrintOpenGL,
|
||||||
"shading language version - slv",
|
.generateJsonResult = (void*) ffGenerateOpenGLJsonResult,
|
||||||
"ogl library used - library",
|
.generateJsonConfig = (void*) ffGenerateOpenGLJsonConfig,
|
||||||
}));
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}
|
{"OpenGL version", "version"},
|
||||||
|
{"OpenGL renderer", "renderer"},
|
||||||
|
{"OpenGL vendor", "vendor"},
|
||||||
|
{"OpenGL shading language version", "slv"},
|
||||||
|
{"OpenGL library used", "library"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitOpenGLOptions(FFOpenGLOptions* options)
|
void ffInitOpenGLOptions(FFOpenGLOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_OPENGL_MODULE_NAME,
|
|
||||||
"Print highest OpenGL version supported by the GPU",
|
|
||||||
ffParseOpenGLCommandOptions,
|
|
||||||
ffParseOpenGLJsonObject,
|
|
||||||
ffPrintOpenGL,
|
|
||||||
ffGenerateOpenGLJsonResult,
|
|
||||||
ffPrintOpenGLHelpFormat,
|
|
||||||
ffGenerateOpenGLJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->library = FF_OPENGL_LIBRARY_AUTO;
|
options->library = FF_OPENGL_LIBRARY_AUTO;
|
||||||
|
|||||||
+25
-31
@@ -7,8 +7,6 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#define FF_OS_NUM_FORMAT_ARGS 12
|
|
||||||
|
|
||||||
static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result)
|
static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result)
|
||||||
{
|
{
|
||||||
//Create the basic output
|
//Create the basic output
|
||||||
@@ -111,7 +109,7 @@ void ffPrintOS(FFOSOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_OS_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_OS_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(instance.state.platform.sysinfo.name, "sysname"),
|
FF_FORMAT_ARG(instance.state.platform.sysinfo.name, "sysname"),
|
||||||
FF_FORMAT_ARG(os->name, "name"),
|
FF_FORMAT_ARG(os->name, "name"),
|
||||||
FF_FORMAT_ARG(os->prettyName, "pretty-name"),
|
FF_FORMAT_ARG(os->prettyName, "pretty-name"),
|
||||||
@@ -186,37 +184,33 @@ void ffGenerateOSJsonResult(FF_MAYBE_UNUSED FFOSOptions* options, yyjson_mut_doc
|
|||||||
yyjson_mut_obj_add_strbuf(doc, obj, "versionID", &os->versionID);
|
yyjson_mut_obj_add_strbuf(doc, obj, "versionID", &os->versionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintOSHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_OS_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_OS_MODULE_NAME, "{3} {10} {12}", FF_OS_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print operating system name and version",
|
||||||
"Name of the kernel (Linux, WIN32_NT, Darwin, FreeBSD) - sysname",
|
.parseCommandOptions = (void*) ffParseOSCommandOptions,
|
||||||
"Name of the OS - name",
|
.parseJsonObject = (void*) ffParseOSJsonObject,
|
||||||
"Pretty name of the OS - pretty-name",
|
.printModule = (void*) ffPrintOS,
|
||||||
"ID of the OS - id",
|
.generateJsonResult = (void*) ffGenerateOSJsonResult,
|
||||||
"ID like of the OS - id-like",
|
.generateJsonConfig = (void*) ffGenerateOSJsonConfig,
|
||||||
"Variant of the OS - variant",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Variant ID of the OS - variant-id",
|
{"Name of the kernel", "sysname"},
|
||||||
"Version of the OS - version",
|
{"Name of the OS", "name"},
|
||||||
"Version ID of the OS - version-id",
|
{"Pretty name of the OS", "pretty-name"},
|
||||||
"Version codename of the OS - codename",
|
{"ID of the OS", "id"},
|
||||||
"Build ID of the OS - build-id",
|
{"ID like of the OS", "id-like"},
|
||||||
"Architecture of the OS - arch",
|
{"Variant of the OS", "variant"},
|
||||||
}));
|
{"Variant ID of the OS", "variant-id"},
|
||||||
}
|
{"Version of the OS", "version"},
|
||||||
|
{"Version ID of the OS", "version-id"},
|
||||||
|
{"Version codename of the OS", "codename"},
|
||||||
|
{"Build ID of the OS", "build-id"},
|
||||||
|
{"Architecture of the OS", "arch"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitOSOptions(FFOSOptions* options)
|
void ffInitOSOptions(FFOSOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_OS_MODULE_NAME,
|
|
||||||
"Print operating system name and version",
|
|
||||||
ffParseOSCommandOptions,
|
|
||||||
ffParseOSJsonObject,
|
|
||||||
ffPrintOS,
|
|
||||||
ffGenerateOSJsonResult,
|
|
||||||
ffPrintOSHelpFormat,
|
|
||||||
ffGenerateOSJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs,
|
ffOptionInitModuleArg(&options->moduleArgs,
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
""
|
""
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/packages/packages.h"
|
#include "modules/packages/packages.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_PACKAGES_NUM_FORMAT_ARGS 40
|
|
||||||
|
|
||||||
void ffPrintPackages(FFPackagesOptions* options)
|
void ffPrintPackages(FFPackagesOptions* options)
|
||||||
{
|
{
|
||||||
FFPackagesResult counts = {};
|
FFPackagesResult counts = {};
|
||||||
@@ -84,7 +82,7 @@ void ffPrintPackages(FFPackagesOptions* options)
|
|||||||
uint32_t flatpakAll = counts.flatpakSystem + counts.flatpakUser;
|
uint32_t flatpakAll = counts.flatpakSystem + counts.flatpakUser;
|
||||||
uint32_t brewAll = counts.brew + counts.brewCask;
|
uint32_t brewAll = counts.brew + counts.brewCask;
|
||||||
uint32_t guixAll = counts.guixSystem + counts.guixUser + counts.guixHome;
|
uint32_t guixAll = counts.guixSystem + counts.guixUser + counts.guixHome;
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PACKAGES_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(counts.all, "all"),
|
FF_FORMAT_ARG(counts.all, "all"),
|
||||||
FF_FORMAT_ARG(counts.pacman, "pacman"),
|
FF_FORMAT_ARG(counts.pacman, "pacman"),
|
||||||
FF_FORMAT_ARG(counts.pacmanBranch, "pacman-branch"),
|
FF_FORMAT_ARG(counts.pacmanBranch, "pacman-branch"),
|
||||||
@@ -437,65 +435,61 @@ void ffGeneratePackagesJsonResult(FF_MAYBE_UNUSED FFPackagesOptions* options, yy
|
|||||||
yyjson_mut_obj_add_strbuf(doc, obj, "pacmanBranch", &counts.pacmanBranch);
|
yyjson_mut_obj_add_strbuf(doc, obj, "pacmanBranch", &counts.pacmanBranch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintPackagesHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_PACKAGES_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PACKAGES_MODULE_NAME, "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (MacPorts), {20} (scoop), {21} (choco), {22} (pkgtool), {23} (paludis), {24} (winget), {25} (opkg), {26} (am), {27} (sorcery), {28} (lpkg), {29} (lpkgbuild), {30} (guix-system), {31} (guix-user), {32} (guix-home), {33} (linglong), {34} (pacstall), {35} (mport), {36} qi", FF_PACKAGES_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "List installed package managers and count of installed packages",
|
||||||
"Number of all packages - all",
|
.parseCommandOptions = (void*) ffParsePackagesCommandOptions,
|
||||||
"Number of pacman packages - pacman",
|
.parseJsonObject = (void*) ffParsePackagesJsonObject,
|
||||||
"Pacman branch on manjaro - pacman-branch",
|
.printModule = (void*) ffPrintPackages,
|
||||||
"Number of dpkg packages - dpkg",
|
.generateJsonResult = (void*) ffGeneratePackagesJsonResult,
|
||||||
"Number of rpm packages - rpm",
|
.generateJsonConfig = (void*) ffGeneratePackagesJsonConfig,
|
||||||
"Number of emerge packages - emerge",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Number of eopkg packages - eopkg",
|
{"Number of all packages", "all"},
|
||||||
"Number of xbps packages - xbps",
|
{"Number of pacman packages", "pacman"},
|
||||||
"Number of nix-system packages - nix-system",
|
{"Pacman branch on manjaro", "pacman-branch"},
|
||||||
"Number of nix-user packages - nix-user",
|
{"Number of dpkg packages", "dpkg"},
|
||||||
"Number of nix-default packages - nix-default",
|
{"Number of rpm packages", "rpm"},
|
||||||
"Number of apk packages - apk",
|
{"Number of emerge packages", "emerge"},
|
||||||
"Number of pkg packages - pkg",
|
{"Number of eopkg packages", "eopkg"},
|
||||||
"Number of flatpak-system app packages - flatpak-system",
|
{"Number of xbps packages", "xbps"},
|
||||||
"Number of flatpak-user app packages - flatpak-user",
|
{"Number of nix-system packages", "nix-system"},
|
||||||
"Number of snap packages - snap",
|
{"Number of nix-user packages", "nix-user"},
|
||||||
"Number of brew packages - brew",
|
{"Number of nix-default packages", "nix-default"},
|
||||||
"Number of brew-cask packages - brew-cask",
|
{"Number of apk packages", "apk"},
|
||||||
"Number of macports packages - macports",
|
{"Number of pkg packages", "pkg"},
|
||||||
"Number of scoop packages - scoop",
|
{"Number of flatpak-system app packages", "flatpak-system"},
|
||||||
"Number of choco packages - choco",
|
{"Number of flatpak-user app packages", "flatpak-user"},
|
||||||
"Number of pkgtool packages - pkgtool",
|
{"Number of snap packages", "snap"},
|
||||||
"Number of paludis packages - paludis",
|
{"Number of brew packages", "brew"},
|
||||||
"Number of winget packages - winget",
|
{"Number of brew-cask packages", "brew-cask"},
|
||||||
"Number of opkg packages - opkg",
|
{"Number of macports packages", "macports"},
|
||||||
"Number of am packages - am",
|
{"Number of scoop packages", "scoop"},
|
||||||
"Number of sorcery packages - sorcery",
|
{"Number of choco packages", "choco"},
|
||||||
"Number of lpkg packages - lpkg",
|
{"Number of pkgtool packages", "pkgtool"},
|
||||||
"Number of lpkgbuild packages - lpkgbuild",
|
{"Number of paludis packages", "paludis"},
|
||||||
"Number of guix-system packages - guix-system",
|
{"Number of winget packages", "winget"},
|
||||||
"Number of guix-user packages - guix-user",
|
{"Number of opkg packages", "opkg"},
|
||||||
"Number of guix-home packages - guix-home",
|
{"Number of am packages", "am"},
|
||||||
"Number of linglong packages - linglong",
|
{"Number of sorcery packages", "sorcery"},
|
||||||
"Number of pacstall packages - pacstall",
|
{"Number of lpkg packages", "lpkg"},
|
||||||
"Number of mport packages - mport",
|
{"Number of lpkgbuild packages", "lpkgbuild"},
|
||||||
"Number of qi packages - qi",
|
{"Number of guix-system packages", "guix-system"},
|
||||||
"Total number of all nix packages - nix-all",
|
{"Number of guix-user packages", "guix-user"},
|
||||||
"Total number of all flatpak app packages - flatpak-all",
|
{"Number of guix-home packages", "guix-home"},
|
||||||
"Total number of all brew packages - brew-all",
|
{"Number of linglong packages", "linglong"},
|
||||||
"Total number of all guix packages - guix-all",
|
{"Number of pacstall packages", "pacstall"},
|
||||||
}));
|
{"Number of mport packages", "mport"},
|
||||||
}
|
{"Number of qi packages", "qi"},
|
||||||
|
{"Total number of all nix packages", "nix-all"},
|
||||||
|
{"Total number of all flatpak app packages", "flatpak-all"},
|
||||||
|
{"Total number of all brew packages", "brew-all"},
|
||||||
|
{"Total number of all guix packages", "guix-all"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitPackagesOptions(FFPackagesOptions* options)
|
void ffInitPackagesOptions(FFPackagesOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_PACKAGES_MODULE_NAME,
|
|
||||||
"List installed package managers and count of installed packages",
|
|
||||||
ffParsePackagesCommandOptions,
|
|
||||||
ffParsePackagesJsonObject,
|
|
||||||
ffPrintPackages,
|
|
||||||
ffGeneratePackagesJsonResult,
|
|
||||||
ffPrintPackagesHelpFormat,
|
|
||||||
ffGeneratePackagesJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->disabled = FF_PACKAGES_DISABLE_LIST;
|
options->disabled = FF_PACKAGES_DISABLE_LIST;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_PHYSICALDISK_DISPLAY_NAME "Physical Disk"
|
#define FF_PHYSICALDISK_DISPLAY_NAME "Physical Disk"
|
||||||
#define FF_PHYSICALDISK_NUM_FORMAT_ARGS 10
|
|
||||||
|
|
||||||
static int sortDevices(const FFPhysicalDiskResult* left, const FFPhysicalDiskResult* right)
|
static int sortDevices(const FFPhysicalDiskResult* left, const FFPhysicalDiskResult* right)
|
||||||
{
|
{
|
||||||
@@ -23,7 +22,7 @@ static void formatKey(const FFPhysicalDiskOptions* options, FFPhysicalDiskResult
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ffStrbufClear(key);
|
ffStrbufClear(key);
|
||||||
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, 4, ((FFformatarg[]){
|
FF_PARSE_FORMAT_STRING_CHECKED(key, &options->moduleArgs.key, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(index, "index"),
|
FF_FORMAT_ARG(index, "index"),
|
||||||
FF_FORMAT_ARG(dev->name, "name"),
|
FF_FORMAT_ARG(dev->name, "name"),
|
||||||
FF_FORMAT_ARG(dev->devPath, "dev-path"),
|
FF_FORMAT_ARG(dev->devPath, "dev-path"),
|
||||||
@@ -108,13 +107,13 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options)
|
|||||||
ffTempsAppendNum(dev->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
ffTempsAppendNum(dev->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
|
||||||
if (dev->type & FF_PHYSICALDISK_TYPE_READWRITE)
|
if (dev->type & FF_PHYSICALDISK_TYPE_READWRITE)
|
||||||
readOnlyType = "Read-write";
|
readOnlyType = "Read-write";
|
||||||
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_PHYSICALDISK_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(buffer, "size"),
|
FF_FORMAT_ARG(buffer, "size"),
|
||||||
FF_FORMAT_ARG(dev->name, "name"),
|
FF_FORMAT_ARG(dev->name, "name"),
|
||||||
FF_FORMAT_ARG(dev->interconnect, "interconnect"),
|
FF_FORMAT_ARG(dev->interconnect, "interconnect"),
|
||||||
FF_FORMAT_ARG(physicalType, "type"),
|
|
||||||
FF_FORMAT_ARG(dev->devPath, "dev-path"),
|
FF_FORMAT_ARG(dev->devPath, "dev-path"),
|
||||||
FF_FORMAT_ARG(dev->serial, "serial"),
|
FF_FORMAT_ARG(dev->serial, "serial"),
|
||||||
|
FF_FORMAT_ARG(physicalType, "physical-type"),
|
||||||
FF_FORMAT_ARG(removableType, "removable-type"),
|
FF_FORMAT_ARG(removableType, "removable-type"),
|
||||||
FF_FORMAT_ARG(readOnlyType, "readonly-type"),
|
FF_FORMAT_ARG(readOnlyType, "readonly-type"),
|
||||||
FF_FORMAT_ARG(dev->revision, "revision"),
|
FF_FORMAT_ARG(dev->revision, "revision"),
|
||||||
@@ -250,35 +249,31 @@ void ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintPhysicalDiskHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_PHYSICALDISK_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PHYSICALDISK_MODULE_NAME, "{1} [{6}, {7}, {8}]", FF_PHYSICALDISK_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print physical disk information",
|
||||||
"Device size (formatted) - ",
|
.parseCommandOptions = (void*) ffParsePhysicalDiskCommandOptions,
|
||||||
"Device name",
|
.parseJsonObject = (void*) ffParsePhysicalDiskJsonObject,
|
||||||
"Device interconnect type",
|
.printModule = (void*) ffPrintPhysicalDisk,
|
||||||
"Device raw file path",
|
.generateJsonResult = (void*) ffGeneratePhysicalDiskJsonResult,
|
||||||
"Serial number",
|
.generateJsonConfig = (void*) ffGeneratePhysicalDiskJsonConfig,
|
||||||
"Device kind (SSD or HDD)",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Device kind (Removable or Fixed)",
|
{"Device size (formatted)", "size"},
|
||||||
"Device kind (Read-only or Read-write)",
|
{"Device name", "name"},
|
||||||
"Product revision",
|
{"Device interconnect type", "interconnect"},
|
||||||
"Device temperature (formatted)",
|
{"Device raw file path", "dev-path"},
|
||||||
}));
|
{"Serial number", "serial"},
|
||||||
}
|
{"Device kind (SSD or HDD)", "physical-type"},
|
||||||
|
{"Device kind (Removable or Fixed)", "removable-type"},
|
||||||
|
{"Device kind (Read-only or Read-write)", "readonly-type"},
|
||||||
|
{"Product revision", "revision"},
|
||||||
|
{"Device temperature (formatted)", "temperature"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitPhysicalDiskOptions(FFPhysicalDiskOptions* options)
|
void ffInitPhysicalDiskOptions(FFPhysicalDiskOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_PHYSICALDISK_MODULE_NAME,
|
|
||||||
"Print physical disk information",
|
|
||||||
ffParsePhysicalDiskCommandOptions,
|
|
||||||
ffParsePhysicalDiskJsonObject,
|
|
||||||
ffPrintPhysicalDisk,
|
|
||||||
ffGeneratePhysicalDiskJsonResult,
|
|
||||||
ffPrintPhysicalDiskHelpFormat,
|
|
||||||
ffGeneratePhysicalDiskJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
ffStrbufInit(&options->namePrefix);
|
ffStrbufInit(&options->namePrefix);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "modules/physicalmemory/physicalmemory.h"
|
#include "modules/physicalmemory/physicalmemory.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_PHYSICALMEMORY_NUM_FORMAT_ARGS 11
|
|
||||||
#define FF_PHYSICALMEMORY_DISPLAY_NAME "Physical Memory"
|
#define FF_PHYSICALMEMORY_DISPLAY_NAME "Physical Memory"
|
||||||
|
|
||||||
void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options)
|
void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options)
|
||||||
@@ -54,7 +53,7 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_PHYSICALMEMORY_DISPLAY_NAME, (uint8_t) i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PHYSICALMEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_PHYSICALMEMORY_DISPLAY_NAME, (uint8_t) i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(device->size, "bytes"),
|
FF_FORMAT_ARG(device->size, "bytes"),
|
||||||
FF_FORMAT_ARG(prettySize, "size"),
|
FF_FORMAT_ARG(prettySize, "size"),
|
||||||
FF_FORMAT_ARG(device->maxSpeed, "max-speed"),
|
FF_FORMAT_ARG(device->maxSpeed, "max-speed"),
|
||||||
@@ -154,36 +153,31 @@ void ffGeneratePhysicalMemoryJsonResult(FF_MAYBE_UNUSED FFPhysicalMemoryOptions*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintPhysicalMemoryHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_PHYSICALMEMORY_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PHYSICALMEMORY_MODULE_NAME, "{7} {5}-{3}: {2}, running at {4} MT/s", FF_PHYSICALMEMORY_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print system physical memory devices",
|
||||||
"Size (in bytes) - bytes",
|
.parseCommandOptions = (void*) ffParsePhysicalMemoryCommandOptions,
|
||||||
"Size formatted - size",
|
.parseJsonObject = (void*) ffParsePhysicalMemoryJsonObject,
|
||||||
"Max speed (in MT/s) - max-speed",
|
.printModule = (void*) ffPrintPhysicalMemory,
|
||||||
"Running speed (in MT/s) - running-speed",
|
.generateJsonConfig = (void*) ffGeneratePhysicalMemoryJsonConfig,
|
||||||
"Type (DDR4, DDR5, etc.) - type",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Form factor (SODIMM, DIMM, etc.) - form-factor",
|
{"Size (in bytes)", "bytes"},
|
||||||
"Bank/Device Locator (BANK0/SIMM0, BANK0/SIMM1, etc.) - locator",
|
{"Size formatted", "size"},
|
||||||
"Vendor - vendor",
|
{"Max speed (in MT/s)", "max-speed"},
|
||||||
"Serial number - serial",
|
{"Running speed (in MT/s)", "running-speed"},
|
||||||
"Part number - part-number",
|
{"Type (DDR4, DDR5, etc.)", "type"},
|
||||||
"True if ECC enabled - is-ecc-enabled",
|
{"Form factor (SODIMM, DIMM, etc.)", "form-factor"},
|
||||||
}));
|
{"Bank/Device Locator (BANK0/SIMM0, BANK0/SIMM1, etc.)", "locator"},
|
||||||
}
|
{"Vendor", "vendor"},
|
||||||
|
{"Serial number", "serial"},
|
||||||
|
{"Part number", "part-number"},
|
||||||
|
{"True if ECC enabled", "is-ecc-enabled"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitPhysicalMemoryOptions(FFPhysicalMemoryOptions* options)
|
void ffInitPhysicalMemoryOptions(FFPhysicalMemoryOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_PHYSICALMEMORY_MODULE_NAME,
|
|
||||||
"Print system physical memory devices",
|
|
||||||
ffParsePhysicalMemoryCommandOptions,
|
|
||||||
ffParsePhysicalMemoryJsonObject,
|
|
||||||
ffPrintPhysicalMemory,
|
|
||||||
ffGeneratePhysicalMemoryJsonResult,
|
|
||||||
ffPrintPhysicalMemoryHelpFormat,
|
|
||||||
ffGeneratePhysicalMemoryJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-22
@@ -7,7 +7,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#define FF_PLAYER_DISPLAY_NAME "Media Player"
|
#define FF_PLAYER_DISPLAY_NAME "Media Player"
|
||||||
#define FF_PLAYER_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintPlayer(FFPlayerOptions* options)
|
void ffPrintPlayer(FFPlayerOptions* options)
|
||||||
{
|
{
|
||||||
@@ -73,7 +72,7 @@ void ffPrintPlayer(FFPlayerOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_PLAYER_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PLAYER_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_PLAYER_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(playerPretty, "player"),
|
FF_FORMAT_ARG(playerPretty, "player"),
|
||||||
FF_FORMAT_ARG(media->player, "name"),
|
FF_FORMAT_ARG(media->player, "name"),
|
||||||
FF_FORMAT_ARG(media->playerId, "id"),
|
FF_FORMAT_ARG(media->playerId, "id"),
|
||||||
@@ -133,29 +132,25 @@ void ffGeneratePlayerJsonResult(FF_MAYBE_UNUSED FFMediaOptions* options, yyjson_
|
|||||||
yyjson_mut_obj_add_strbuf(doc, obj, "url", &media->url);
|
yyjson_mut_obj_add_strbuf(doc, obj, "url", &media->url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintPlayerHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_PLAYER_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PLAYER_MODULE_NAME, "{1}", FF_PLAYER_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print music player name",
|
||||||
"Pretty player name - player",
|
.parseCommandOptions = (void*) ffParsePlayerCommandOptions,
|
||||||
"Player name - name",
|
.parseJsonObject = (void*) ffParsePlayerJsonObject,
|
||||||
"Player Identifier - id",
|
.printModule = (void*) ffPrintPlayer,
|
||||||
"URL name - url",
|
.generateJsonResult = (void*) ffGeneratePlayerJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGeneratePlayerJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Pretty player name", "player"},
|
||||||
|
{"Player name", "name"},
|
||||||
|
{"Player Identifier", "id"},
|
||||||
|
{"URL name", "url"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitPlayerOptions(FFPlayerOptions* options)
|
void ffInitPlayerOptions(FFPlayerOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_PLAYER_MODULE_NAME,
|
|
||||||
"Print music player name",
|
|
||||||
ffParsePlayerCommandOptions,
|
|
||||||
ffParsePlayerJsonObject,
|
|
||||||
ffPrintPlayer,
|
|
||||||
ffGeneratePlayerJsonResult,
|
|
||||||
ffPrintPlayerHelpFormat,
|
|
||||||
ffGeneratePlayerJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_POWERADAPTER_DISPLAY_NAME "Power Adapter"
|
#define FF_POWERADAPTER_DISPLAY_NAME "Power Adapter"
|
||||||
#define FF_POWERADAPTER_NUM_FORMAT_ARGS 6
|
|
||||||
|
|
||||||
void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
||||||
{
|
{
|
||||||
@@ -38,7 +37,7 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_POWERADAPTER_DISPLAY_NAME, i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_POWERADAPTER_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_POWERADAPTER_DISPLAY_NAME, i, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result->watts, "watts"),
|
FF_FORMAT_ARG(result->watts, "watts"),
|
||||||
FF_FORMAT_ARG(result->name, "name"),
|
FF_FORMAT_ARG(result->name, "name"),
|
||||||
FF_FORMAT_ARG(result->manufacturer, "manufacturer"),
|
FF_FORMAT_ARG(result->manufacturer, "manufacturer"),
|
||||||
@@ -126,31 +125,27 @@ void ffGeneratePowerAdapterJsonResult(FF_MAYBE_UNUSED FFPowerAdapterOptions* opt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintPowerAdapterHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_POWERADAPTER_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_POWERADAPTER_MODULE_NAME, "{1}W", FF_POWERADAPTER_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print power adapter name and charging watts",
|
||||||
"PowerAdapter watts - watts",
|
.parseCommandOptions = (void*) ffParsePowerAdapterCommandOptions,
|
||||||
"PowerAdapter name - name",
|
.parseJsonObject = (void*) ffParsePowerAdapterJsonObject,
|
||||||
"PowerAdapter manufacturer - manufacturer",
|
.printModule = (void*) ffPrintPowerAdapter,
|
||||||
"PowerAdapter model - model",
|
.generateJsonResult = (void*) ffGeneratePowerAdapterJsonResult,
|
||||||
"PowerAdapter description - description",
|
.generateJsonConfig = (void*) ffGeneratePowerAdapterJsonConfig,
|
||||||
"PowerAdapter serial number - serial",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}));
|
{"Power adapter watts", "watts"},
|
||||||
}
|
{"Power adapter name", "name"},
|
||||||
|
{"Power adapter manufacturer", "manufacturer"},
|
||||||
|
{"Power adapter model", "model"},
|
||||||
|
{"Power adapter description", "description"},
|
||||||
|
{"Power adapter serial number", "serial"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitPowerAdapterOptions(FFPowerAdapterOptions* options)
|
void ffInitPowerAdapterOptions(FFPowerAdapterOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_POWERADAPTER_MODULE_NAME,
|
|
||||||
"Print power adapter name and charging watts",
|
|
||||||
ffParsePowerAdapterCommandOptions,
|
|
||||||
ffParsePowerAdapterJsonObject,
|
|
||||||
ffPrintPowerAdapter,
|
|
||||||
ffGeneratePowerAdapterJsonResult,
|
|
||||||
ffPrintPowerAdapterHelpFormat,
|
|
||||||
ffGeneratePowerAdapterJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/processes/processes.h"
|
#include "modules/processes/processes.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_PROCESSES_NUM_FORMAT_ARGS 1
|
|
||||||
|
|
||||||
void ffPrintProcesses(FFProcessesOptions* options)
|
void ffPrintProcesses(FFProcessesOptions* options)
|
||||||
{
|
{
|
||||||
uint32_t numProcesses = 0;
|
uint32_t numProcesses = 0;
|
||||||
@@ -25,7 +23,7 @@ void ffPrintProcesses(FFProcessesOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_PROCESSES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PROCESSES_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_PROCESSES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(numProcesses, "result")
|
FF_FORMAT_ARG(numProcesses, "result")
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -80,26 +78,22 @@ void ffGenerateProcessesJsonResult(FF_MAYBE_UNUSED FFProcessesOptions* options,
|
|||||||
yyjson_mut_obj_add_uint(doc, module, "result", result);
|
yyjson_mut_obj_add_uint(doc, module, "result", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintProcessesHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_PROCESSES_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PROCESSES_MODULE_NAME, "{1}", FF_PROCESSES_NUM_FORMAT_ARGS, (const char* []) {
|
.description = "Print number of running processes",
|
||||||
"Proecess count - result"
|
.parseCommandOptions = (void*) ffParseProcessesCommandOptions,
|
||||||
});
|
.parseJsonObject = (void*) ffParseProcessesJsonObject,
|
||||||
}
|
.printModule = (void*) ffPrintProcesses,
|
||||||
|
.generateJsonResult = (void*) ffGenerateProcessesJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateProcessesJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Process count", "result"}
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitProcessesOptions(FFProcessesOptions* options)
|
void ffInitProcessesOptions(FFProcessesOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_PROCESSES_MODULE_NAME,
|
|
||||||
"Count running processes",
|
|
||||||
ffParseProcessesCommandOptions,
|
|
||||||
ffParseProcessesJsonObject,
|
|
||||||
ffPrintProcesses,
|
|
||||||
ffGenerateProcessesJsonResult,
|
|
||||||
ffPrintProcessesHelpFormat,
|
|
||||||
ffGenerateProcessesJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_PUBLICIP_DISPLAY_NAME "Public IP"
|
#define FF_PUBLICIP_DISPLAY_NAME "Public IP"
|
||||||
#define FF_PUBLICIP_NUM_FORMAT_ARGS 2
|
|
||||||
|
|
||||||
void ffPrintPublicIp(FFPublicIpOptions* options)
|
void ffPrintPublicIp(FFPublicIpOptions* options)
|
||||||
{
|
{
|
||||||
@@ -30,7 +29,7 @@ void ffPrintPublicIp(FFPublicIpOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_PUBLICIP_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_PUBLICIP_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_PUBLICIP_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result.ip, "ip"),
|
FF_FORMAT_ARG(result.ip, "ip"),
|
||||||
FF_FORMAT_ARG(result.location, "location"),
|
FF_FORMAT_ARG(result.location, "location"),
|
||||||
}));
|
}));
|
||||||
@@ -141,27 +140,23 @@ void ffGeneratePublicIpJsonResult(FFPublicIpOptions* options, yyjson_mut_doc* do
|
|||||||
ffStrbufDestroy(&result.location);
|
ffStrbufDestroy(&result.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintPublicIpHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_PUBLICIP_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PUBLICIP_MODULE_NAME, "{1} ({2})", FF_PUBLICIP_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print your public IP address, etc",
|
||||||
"Public IP address - ip",
|
.parseCommandOptions = (void*) ffParsePublicIpCommandOptions,
|
||||||
"Location - location",
|
.parseJsonObject = (void*) ffParsePublicIpJsonObject,
|
||||||
}));
|
.printModule = (void*) ffPrintPublicIp,
|
||||||
}
|
.generateJsonResult = (void*) ffGeneratePublicIpJsonResult,
|
||||||
|
.generateJsonConfig = (void*) ffGeneratePublicIpJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Public IP address", "ip"},
|
||||||
|
{"Location", "location"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitPublicIpOptions(FFPublicIpOptions* options)
|
void ffInitPublicIpOptions(FFPublicIpOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_PUBLICIP_MODULE_NAME,
|
|
||||||
"Print your public IP address, etc",
|
|
||||||
ffParsePublicIpCommandOptions,
|
|
||||||
ffParsePublicIpJsonObject,
|
|
||||||
ffPrintPublicIp,
|
|
||||||
ffGeneratePublicIpJsonResult,
|
|
||||||
ffPrintPublicIpHelpFormat,
|
|
||||||
ffGeneratePublicIpJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
ffStrbufInit(&options->url);
|
ffStrbufInit(&options->url);
|
||||||
|
|||||||
@@ -178,19 +178,23 @@ void ffGenerateSeparatorJsonConfig(FFSeparatorOptions* options, yyjson_mut_doc*
|
|||||||
yyjson_mut_obj_add_strbuf(doc, module, "string", &options->string);
|
yyjson_mut_obj_add_strbuf(doc, module, "string", &options->string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
|
.name = FF_SEPARATOR_MODULE_NAME,
|
||||||
|
.description = "Print a separator line",
|
||||||
|
.parseCommandOptions = (void*) ffParseSeparatorCommandOptions,
|
||||||
|
.parseJsonObject = (void*) ffParseSeparatorJsonObject,
|
||||||
|
.printModule = (void*) ffPrintSeparator,
|
||||||
|
.generateJsonConfig = (void*) ffGenerateSeparatorJsonConfig,
|
||||||
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Separator string", "string"},
|
||||||
|
{"Output color", "outputColor"},
|
||||||
|
{"Length", "length"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitSeparatorOptions(FFSeparatorOptions* options)
|
void ffInitSeparatorOptions(FFSeparatorOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_SEPARATOR_MODULE_NAME,
|
|
||||||
"Print a separator line",
|
|
||||||
ffParseSeparatorCommandOptions,
|
|
||||||
ffParseSeparatorJsonObject,
|
|
||||||
ffPrintSeparator,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
ffGenerateSeparatorJsonConfig
|
|
||||||
);
|
|
||||||
ffStrbufInitStatic(&options->string, "-");
|
ffStrbufInitStatic(&options->string, "-");
|
||||||
ffStrbufInit(&options->outputColor);
|
ffStrbufInit(&options->outputColor);
|
||||||
options->length = 0;
|
options->length = 0;
|
||||||
|
|||||||
+21
-27
@@ -4,8 +4,6 @@
|
|||||||
#include "modules/shell/shell.h"
|
#include "modules/shell/shell.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_SHELL_NUM_FORMAT_ARGS 8
|
|
||||||
|
|
||||||
void ffPrintShell(FFShellOptions* options)
|
void ffPrintShell(FFShellOptions* options)
|
||||||
{
|
{
|
||||||
const FFShellResult* result = ffDetectShell();
|
const FFShellResult* result = ffDetectShell();
|
||||||
@@ -31,7 +29,7 @@ void ffPrintShell(FFShellOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_SHELL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SHELL_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_SHELL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(result->processName, "process-name"),
|
FF_FORMAT_ARG(result->processName, "process-name"),
|
||||||
FF_FORMAT_ARG(result->exe, "exe"),
|
FF_FORMAT_ARG(result->exe, "exe"),
|
||||||
FF_FORMAT_ARG(result->exeName, "exe-name"),
|
FF_FORMAT_ARG(result->exeName, "exe-name"),
|
||||||
@@ -104,33 +102,29 @@ void ffGenerateShellJsonResult(FF_MAYBE_UNUSED FFShellOptions* options, yyjson_m
|
|||||||
yyjson_mut_obj_add_null(doc, obj, "tty");
|
yyjson_mut_obj_add_null(doc, obj, "tty");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintShellHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_SHELL_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_SHELL_MODULE_NAME, "{3} {4}", FF_SHELL_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print current shell name and version",
|
||||||
"Shell process name - process-name",
|
.parseCommandOptions = (void*) ffParseShellCommandOptions,
|
||||||
"The first argument of the command line when running the shell - exe",
|
.parseJsonObject = (void*) ffParseShellJsonObject,
|
||||||
"Shell base name of arg0 - exe-name",
|
.printModule = (void*) ffPrintShell,
|
||||||
"Shell version - version",
|
.generateJsonResult = (void*) ffGenerateShellJsonResult,
|
||||||
"Shell pid - pid",
|
.generateJsonConfig = (void*) ffGenerateShellJsonConfig,
|
||||||
"Shell pretty name - pretty-name",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Shell full exe path - exe-path",
|
{"Shell process name", "process-name"},
|
||||||
"Shell tty used - tty",
|
{"The first argument of the command line when running the shell", "exe"},
|
||||||
}));
|
{"Shell base name of arg0", "exe-name"},
|
||||||
}
|
{"Shell version", "version"},
|
||||||
|
{"Shell pid", "pid"},
|
||||||
|
{"Shell pretty name", "pretty-name"},
|
||||||
|
{"Shell full exe path", "exe-path"},
|
||||||
|
{"Shell tty used", "tty"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitShellOptions(FFShellOptions* options)
|
void ffInitShellOptions(FFShellOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_SHELL_MODULE_NAME,
|
|
||||||
"Print current shell name and version",
|
|
||||||
ffParseShellCommandOptions,
|
|
||||||
ffParseShellJsonObject,
|
|
||||||
ffPrintShell,
|
|
||||||
ffGenerateShellJsonResult,
|
|
||||||
ffPrintShellHelpFormat,
|
|
||||||
ffGenerateShellJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-24
@@ -5,8 +5,6 @@
|
|||||||
#include "modules/sound/sound.h"
|
#include "modules/sound/sound.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_SOUND_NUM_FORMAT_ARGS 5
|
|
||||||
|
|
||||||
static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, uint8_t index)
|
static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, uint8_t index)
|
||||||
{
|
{
|
||||||
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
||||||
@@ -54,7 +52,7 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui
|
|||||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||||
ffPercentAppendBar(&percentageBar, device->volume, options->percent, &options->moduleArgs);
|
ffPercentAppendBar(&percentageBar, device->volume, options->percent, &options->moduleArgs);
|
||||||
|
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_SOUND_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SOUND_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
FF_PRINT_FORMAT_CHECKED(FF_SOUND_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||||
FF_FORMAT_ARG(device->main, "is-main"),
|
FF_FORMAT_ARG(device->main, "is-main"),
|
||||||
FF_FORMAT_ARG(device->name, "name"),
|
FF_FORMAT_ARG(device->name, "name"),
|
||||||
FF_FORMAT_ARG(percentageNum, "volume-percentage"),
|
FF_FORMAT_ARG(percentageNum, "volume-percentage"),
|
||||||
@@ -229,30 +227,26 @@ void ffGenerateSoundJsonResult(FF_MAYBE_UNUSED FFSoundOptions* options, yyjson_m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintSoundHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_SOUND_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_SOUND_MODULE_NAME, "{2} ({3}%)", FF_SOUND_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print sound devices, volume, etc",
|
||||||
"Is main sound device - is-main",
|
.parseCommandOptions = (void*) ffParseSoundCommandOptions,
|
||||||
"Device name - name",
|
.parseJsonObject = (void*) ffParseSoundJsonObject,
|
||||||
"Volume (in percentage num) - volume-percentage",
|
.printModule = (void*) ffPrintSound,
|
||||||
"Identifier - identifier",
|
.generateJsonResult = (void*) ffGenerateSoundJsonResult,
|
||||||
"Volume (in percentage bar) - volume-percentage-bar",
|
.generateJsonConfig = (void*) ffGenerateSoundJsonConfig,
|
||||||
}));
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
}
|
{"Is main sound device", "is-main"},
|
||||||
|
{"Device name", "name"},
|
||||||
|
{"Volume (in percentage num)", "volume-percentage"},
|
||||||
|
{"Identifier", "identifier"},
|
||||||
|
{"Volume (in percentage bar)", "volume-percentage-bar"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitSoundOptions(FFSoundOptions* options)
|
void ffInitSoundOptions(FFSoundOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_SOUND_MODULE_NAME,
|
|
||||||
"Print sound devices, volume, etc",
|
|
||||||
ffParseSoundCommandOptions,
|
|
||||||
ffParseSoundJsonObject,
|
|
||||||
ffPrintSound,
|
|
||||||
ffGenerateSoundJsonResult,
|
|
||||||
ffPrintSoundHelpFormat,
|
|
||||||
ffGenerateSoundJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
|
|
||||||
options->soundType = FF_SOUND_TYPE_MAIN;
|
options->soundType = FF_SOUND_TYPE_MAIN;
|
||||||
|
|||||||
+17
-23
@@ -6,8 +6,6 @@
|
|||||||
#include "modules/swap/swap.h"
|
#include "modules/swap/swap.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_SWAP_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintSwap(FFSwapOptions* options)
|
void ffPrintSwap(FFSwapOptions* options)
|
||||||
{
|
{
|
||||||
FFSwapResult storage = {};
|
FFSwapResult storage = {};
|
||||||
@@ -73,7 +71,7 @@ void ffPrintSwap(FFSwapOptions* options)
|
|||||||
FF_STRBUF_AUTO_DESTROY percentageBar = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY percentageBar = ffStrbufCreate();
|
||||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||||
ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs);
|
ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs);
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SWAP_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(usedPretty, "used"),
|
FF_FORMAT_ARG(usedPretty, "used"),
|
||||||
FF_FORMAT_ARG(totalPretty, "total"),
|
FF_FORMAT_ARG(totalPretty, "total"),
|
||||||
FF_FORMAT_ARG(percentageNum, "percentage"),
|
FF_FORMAT_ARG(percentageNum, "percentage"),
|
||||||
@@ -141,29 +139,25 @@ void ffGenerateSwapJsonResult(FF_MAYBE_UNUSED FFSwapOptions* options, yyjson_mut
|
|||||||
yyjson_mut_obj_add_uint(doc, obj, "used", storage.bytesUsed);
|
yyjson_mut_obj_add_uint(doc, obj, "used", storage.bytesUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintSwapHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_SWAP_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_SWAP_MODULE_NAME, "{1} / {2} ({3})", FF_SWAP_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print swap (paging file) space usage",
|
||||||
"Used size - used",
|
.parseCommandOptions = (void*) ffParseSwapCommandOptions,
|
||||||
"Total size - total",
|
.parseJsonObject = (void*) ffParseSwapJsonObject,
|
||||||
"Percentage used (num) - percentage",
|
.printModule = (void*) ffPrintSwap,
|
||||||
"Percentage used (bar) - percentage-bar",
|
.generateJsonResult = (void*) ffGenerateSwapJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateSwapJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Used size", "used"},
|
||||||
|
{"Total size", "total"},
|
||||||
|
{"Percentage used (num)", "percentage"},
|
||||||
|
{"Percentage used (bar)", "percentage-bar"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitSwapOptions(FFSwapOptions* options)
|
void ffInitSwapOptions(FFSwapOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_SWAP_MODULE_NAME,
|
|
||||||
"Print swap (paging file) space usage",
|
|
||||||
ffParseSwapCommandOptions,
|
|
||||||
ffParseSwapJsonObject,
|
|
||||||
ffPrintSwap,
|
|
||||||
ffGenerateSwapJsonResult,
|
|
||||||
ffPrintSwapHelpFormat,
|
|
||||||
ffGenerateSwapJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
#include "modules/terminal/terminal.h"
|
#include "modules/terminal/terminal.h"
|
||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define FF_TERMINAL_NUM_FORMAT_ARGS 8
|
|
||||||
|
|
||||||
void ffPrintTerminal(FFTerminalOptions* options)
|
void ffPrintTerminal(FFTerminalOptions* options)
|
||||||
{
|
{
|
||||||
const FFTerminalResult* result = ffDetectTerminal();
|
const FFTerminalResult* result = ffDetectTerminal();
|
||||||
@@ -29,7 +25,7 @@ void ffPrintTerminal(FFTerminalOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_TERMINAL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINAL_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_TERMINAL_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result->processName, "process-name"),
|
FF_FORMAT_ARG(result->processName, "process-name"),
|
||||||
FF_FORMAT_ARG(result->exe, "exe"),
|
FF_FORMAT_ARG(result->exe, "exe"),
|
||||||
FF_FORMAT_ARG(result->exeName, "exe-name"),
|
FF_FORMAT_ARG(result->exeName, "exe-name"),
|
||||||
@@ -99,33 +95,29 @@ void ffGenerateTerminalJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options, yy
|
|||||||
yyjson_mut_obj_add_strbuf(doc, obj, "tty", &result->tty);
|
yyjson_mut_obj_add_strbuf(doc, obj, "tty", &result->tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintTerminalHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_TERMINAL_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TERMINAL_MODULE_NAME, "{5} {6}", FF_TERMINAL_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print current terminal name and version",
|
||||||
"Terminal process name - process-name",
|
.parseCommandOptions = (void*) ffParseTerminalCommandOptions,
|
||||||
"The first argument of the command line when running the terminal - exe",
|
.parseJsonObject = (void*) ffParseTerminalJsonObject,
|
||||||
"Terminal base name of arg0 - exe-name",
|
.printModule = (void*) ffPrintTerminal,
|
||||||
"Terminal pid - pid",
|
.generateJsonResult = (void*) ffGenerateTerminalJsonResult,
|
||||||
"Terminal pretty name - pretty-name",
|
.generateJsonConfig = (void*) ffGenerateTerminalJsonConfig,
|
||||||
"Terminal version - version",
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
"Terminal full exe path - exe-path",
|
{"Terminal process name", "process-name"},
|
||||||
"Terminal tty / pts used - tty",
|
{"The first argument of the command line when running the terminal", "exe"},
|
||||||
}));
|
{"Terminal base name of arg0", "exe-name"},
|
||||||
}
|
{"Terminal pid", "pid"},
|
||||||
|
{"Terminal pretty name", "pretty-name"},
|
||||||
|
{"Terminal version", "version"},
|
||||||
|
{"Terminal full exe path", "exe-path"},
|
||||||
|
{"Terminal tty / pts used", "tty"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitTerminalOptions(FFTerminalOptions* options)
|
void ffInitTerminalOptions(FFTerminalOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_TERMINAL_MODULE_NAME,
|
|
||||||
"Print current terminal name and version",
|
|
||||||
ffParseTerminalCommandOptions,
|
|
||||||
ffParseTerminalJsonObject,
|
|
||||||
ffPrintTerminal,
|
|
||||||
ffGenerateTerminalJsonResult,
|
|
||||||
ffPrintTerminalHelpFormat,
|
|
||||||
ffGenerateTerminalJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_TERMINALFONT_DISPLAY_NAME "Terminal Font"
|
#define FF_TERMINALFONT_DISPLAY_NAME "Terminal Font"
|
||||||
#define FF_TERMINALFONT_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintTerminalFont(FFTerminalFontOptions* options)
|
void ffPrintTerminalFont(FFTerminalFontOptions* options)
|
||||||
{
|
{
|
||||||
@@ -33,7 +32,7 @@ void ffPrintTerminalFont(FFTerminalFontOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALFONT_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(terminalFont.font.pretty, "combined"),
|
FF_FORMAT_ARG(terminalFont.font.pretty, "combined"),
|
||||||
FF_FORMAT_ARG(terminalFont.font.name, "name"),
|
FF_FORMAT_ARG(terminalFont.font.name, "name"),
|
||||||
FF_FORMAT_ARG(terminalFont.font.size, "size"),
|
FF_FORMAT_ARG(terminalFont.font.size, "size"),
|
||||||
@@ -121,29 +120,25 @@ void ffGenerateTerminalFontJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options
|
|||||||
ffFontDestroy(&result.fallback);
|
ffFontDestroy(&result.fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintTerminalFontHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_TERMINALFONT_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TERMINALFONT_MODULE_NAME, "{1}", FF_TERMINALFONT_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print font name and size used by current terminal",
|
||||||
"Terminal font combined - combined",
|
.parseCommandOptions = (void*) ffParseTerminalFontCommandOptions,
|
||||||
"Terminal font name - name",
|
.parseJsonObject = (void*) ffParseTerminalFontJsonObject,
|
||||||
"Terminal font size - size",
|
.printModule = (void*) ffPrintTerminalFont,
|
||||||
"Terminal font styles - styles",
|
.generateJsonResult = (void*) ffGenerateTerminalFontJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateTerminalFontJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Terminal font combined", "combined"},
|
||||||
|
{"Terminal font name", "name"},
|
||||||
|
{"Terminal font size", "size"},
|
||||||
|
{"Terminal font styles", "styles"},
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitTerminalFontOptions(FFTerminalFontOptions* options)
|
void ffInitTerminalFontOptions(FFTerminalFontOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_TERMINALFONT_MODULE_NAME,
|
|
||||||
"Print font name and size used by current terminal",
|
|
||||||
ffParseTerminalFontCommandOptions,
|
|
||||||
ffParseTerminalFontJsonObject,
|
|
||||||
ffPrintTerminalFont,
|
|
||||||
ffGenerateTerminalFontJsonResult,
|
|
||||||
ffPrintTerminalFontHelpFormat,
|
|
||||||
ffGenerateTerminalFontJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
#include "util/stringUtils.h"
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#define FF_TERMINALSIZE_DISPLAY_NAME "Terminal Size"
|
#define FF_TERMINALSIZE_DISPLAY_NAME "Terminal Size"
|
||||||
#define FF_TERMINALSIZE_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintTerminalSize(FFTerminalSizeOptions* options)
|
void ffPrintTerminalSize(FFTerminalSizeOptions* options)
|
||||||
{
|
{
|
||||||
@@ -29,7 +28,7 @@ void ffPrintTerminalSize(FFTerminalSizeOptions* options)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_TERMINALSIZE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALSIZE_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_TERMINALSIZE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(result.rows, "rows"),
|
FF_FORMAT_ARG(result.rows, "rows"),
|
||||||
FF_FORMAT_ARG(result.columns, "columns"),
|
FF_FORMAT_ARG(result.columns, "columns"),
|
||||||
FF_FORMAT_ARG(result.width, "width"),
|
FF_FORMAT_ARG(result.width, "width"),
|
||||||
@@ -91,29 +90,25 @@ void ffGenerateTerminalSizeJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options
|
|||||||
yyjson_mut_obj_add_uint(doc, obj, "height", result.height);
|
yyjson_mut_obj_add_uint(doc, obj, "height", result.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintTerminalSizeHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_TERMINALSIZE_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TERMINALSIZE_MODULE_NAME, "{1} columns x {2} rows ({3}px x {4}px)", FF_TERMINALSIZE_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print current terminal size",
|
||||||
"Terminal rows - rows",
|
.parseCommandOptions = (void*) ffParseTerminalSizeCommandOptions,
|
||||||
"Terminal columns - columns",
|
.parseJsonObject = (void*) ffParseTerminalSizeJsonObject,
|
||||||
"Terminal width (in pixels) - width",
|
.printModule = (void*) ffPrintTerminalSize,
|
||||||
"Terminal height (in pixels) - height",
|
.generateJsonResult = (void*) ffGenerateTerminalSizeJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateTerminalSizeJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Terminal rows", "rows"},
|
||||||
|
{"Terminal columns", "columns"},
|
||||||
|
{"Terminal width (in pixels)", "width"},
|
||||||
|
{"Terminal height (in pixels)", "height"},
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitTerminalSizeOptions(FFTerminalSizeOptions* options)
|
void ffInitTerminalSizeOptions(FFTerminalSizeOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_TERMINALSIZE_MODULE_NAME,
|
|
||||||
"Print current terminal size",
|
|
||||||
ffParseTerminalSizeCommandOptions,
|
|
||||||
ffParseTerminalSizeJsonObject,
|
|
||||||
ffPrintTerminalSize,
|
|
||||||
ffGenerateTerminalSizeJsonResult,
|
|
||||||
ffPrintTerminalSizeHelpFormat,
|
|
||||||
ffGenerateTerminalSizeJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#define FF_TERMINALTHEME_DISPLAY_NAME "Terminal Theme"
|
#define FF_TERMINALTHEME_DISPLAY_NAME "Terminal Theme"
|
||||||
#define FF_TERMINALTHEME_NUM_FORMAT_ARGS 4
|
|
||||||
|
|
||||||
void ffPrintTerminalTheme(FFTerminalThemeOptions* options)
|
void ffPrintTerminalTheme(FFTerminalThemeOptions* options)
|
||||||
{
|
{
|
||||||
@@ -34,7 +33,7 @@ void ffPrintTerminalTheme(FFTerminalThemeOptions* options)
|
|||||||
const char* bgType = result.bg.dark ? "Dark" : "Light";
|
const char* bgType = result.bg.dark ? "Dark" : "Light";
|
||||||
snprintf(fg, ARRAY_SIZE(fg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.fg.r, result.fg.g, result.fg.b);
|
snprintf(fg, ARRAY_SIZE(fg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.fg.r, result.fg.g, result.fg.b);
|
||||||
snprintf(bg, ARRAY_SIZE(bg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.bg.r, result.bg.g, result.bg.b);
|
snprintf(bg, ARRAY_SIZE(bg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.bg.r, result.bg.g, result.bg.b);
|
||||||
FF_PRINT_FORMAT_CHECKED(FF_TERMINALTHEME_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_TERMINALTHEME_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
FF_PRINT_FORMAT_CHECKED(FF_TERMINALTHEME_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||||
FF_FORMAT_ARG(fg, "fg-color"),
|
FF_FORMAT_ARG(fg, "fg-color"),
|
||||||
FF_FORMAT_ARG(fgType, "fg-type"),
|
FF_FORMAT_ARG(fgType, "fg-type"),
|
||||||
FF_FORMAT_ARG(bg, "bg-color"),
|
FF_FORMAT_ARG(bg, "bg-color"),
|
||||||
@@ -104,29 +103,25 @@ void ffGenerateTerminalThemeJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* option
|
|||||||
yyjson_mut_obj_add_bool(doc, bg, "dark", result.bg.dark);
|
yyjson_mut_obj_add_bool(doc, bg, "dark", result.bg.dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintTerminalThemeHelpFormat(void)
|
static FFModuleBaseInfo ffModuleInfo = {
|
||||||
{
|
.name = FF_TERMINALTHEME_MODULE_NAME,
|
||||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_TERMINALTHEME_MODULE_NAME, "{1} (FG) {3} (BG) [{4}]", FF_TERMINALTHEME_NUM_FORMAT_ARGS, ((const char* []) {
|
.description = "Print current terminal theme (foreground and background colors)",
|
||||||
"Terminal foreground color - fg-color",
|
.parseCommandOptions = (void*) ffParseTerminalThemeCommandOptions,
|
||||||
"Terminal foreground type (Dark / Light) - fg-type",
|
.parseJsonObject = (void*) ffParseTerminalThemeJsonObject,
|
||||||
"Terminal background color - bg-color",
|
.printModule = (void*) ffPrintTerminalTheme,
|
||||||
"Terminal background type (Dark / Light) - bg-type",
|
.generateJsonResult = (void*) ffGenerateTerminalThemeJsonResult,
|
||||||
}));
|
.generateJsonConfig = (void*) ffGenerateTerminalThemeJsonConfig,
|
||||||
}
|
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||||
|
{"Terminal foreground color", "fg-color"},
|
||||||
|
{"Terminal foreground type (Dark / Light)", "fg-type"},
|
||||||
|
{"Terminal background color", "bg-color"},
|
||||||
|
{"Terminal background type (Dark / Light)", "bg-type"},
|
||||||
|
}))
|
||||||
|
};
|
||||||
|
|
||||||
void ffInitTerminalThemeOptions(FFTerminalThemeOptions* options)
|
void ffInitTerminalThemeOptions(FFTerminalThemeOptions* options)
|
||||||
{
|
{
|
||||||
ffOptionInitModuleBaseInfo(
|
options->moduleInfo = ffModuleInfo;
|
||||||
&options->moduleInfo,
|
|
||||||
FF_TERMINALTHEME_MODULE_NAME,
|
|
||||||
"Print current terminal theme (foreground and background colors)",
|
|
||||||
ffParseTerminalThemeCommandOptions,
|
|
||||||
ffParseTerminalThemeJsonObject,
|
|
||||||
ffPrintTerminalTheme,
|
|
||||||
ffGenerateTerminalThemeJsonResult,
|
|
||||||
ffPrintTerminalThemeHelpFormat,
|
|
||||||
ffGenerateTerminalThemeJsonConfig
|
|
||||||
);
|
|
||||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user