mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-03 11:44:18 +01:00
Users: add missing module settings
This commit is contained in:
@@ -326,6 +326,9 @@ __fastfetch_completion()
|
||||
"--opencl-key"
|
||||
"--opencl-format"
|
||||
"--opencl-error"
|
||||
"--users-key"
|
||||
"--users-format"
|
||||
"--users-error"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_PATH=(
|
||||
|
||||
@@ -196,6 +196,7 @@ static void defaultConfig(FFinstance* instance)
|
||||
initModuleArg(&instance->config.vulkan);
|
||||
initModuleArg(&instance->config.openGL);
|
||||
initModuleArg(&instance->config.openCL);
|
||||
initModuleArg(&instance->config.users);
|
||||
|
||||
ffStrbufInitA(&instance->config.libPCI, 0);
|
||||
ffStrbufInitA(&instance->config.libVulkan, 0);
|
||||
|
||||
@@ -219,6 +219,7 @@
|
||||
#--vulkan-key Vulkan
|
||||
#--opengl-key OpenGL
|
||||
#--opencl-key OpenCL
|
||||
#--users-key Users
|
||||
|
||||
# Format options:
|
||||
# Sets the format string for module values.
|
||||
@@ -259,6 +260,7 @@
|
||||
#--vulkan-format
|
||||
#--opengl-format
|
||||
#--opencl-format
|
||||
#--users-format
|
||||
|
||||
# Error options:
|
||||
# Sets the format string to use if an error occured
|
||||
@@ -299,6 +301,7 @@
|
||||
#--vulkan-error
|
||||
#--opengl-error
|
||||
#--opencl-error
|
||||
#--users-error
|
||||
|
||||
# Library options:
|
||||
# Sets an user specific path to a library to load.
|
||||
|
||||
@@ -1199,6 +1199,12 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
optionParseString(key, value, &instance->config.openCL.outputFormat);
|
||||
else if(strcasecmp(key, "--opencl-error") == 0)
|
||||
optionParseString(key, value, &instance->config.openCL.errorFormat);
|
||||
else if(strcasecmp(key, "--users-key") == 0)
|
||||
optionParseString(key, value, &instance->config.users.key);
|
||||
else if(strcasecmp(key, "--users-format") == 0)
|
||||
optionParseString(key, value, &instance->config.users.outputFormat);
|
||||
else if(strcasecmp(key, "--users-error") == 0)
|
||||
optionParseString(key, value, &instance->config.users.errorFormat);
|
||||
|
||||
///////////////////
|
||||
//Library options//
|
||||
|
||||
@@ -128,6 +128,7 @@ typedef struct FFconfig
|
||||
FFModuleArgs vulkan;
|
||||
FFModuleArgs openGL;
|
||||
FFModuleArgs openCL;
|
||||
FFModuleArgs users;
|
||||
|
||||
FFstrbuf libPCI;
|
||||
FFstrbuf libVulkan;
|
||||
|
||||
+10
-3
@@ -36,6 +36,13 @@ next:
|
||||
}
|
||||
}
|
||||
|
||||
if(users.length == 0)
|
||||
{
|
||||
ffListDestroy(&users);
|
||||
ffPrintError(instance, FF_USERS_MODULE_NAME, 0, &instance->config.users, "Unable to detect users");
|
||||
return;
|
||||
}
|
||||
|
||||
FFstrbuf result;
|
||||
ffStrbufInit(&result);
|
||||
for(uint32_t i = 0; i < users.length; ++i)
|
||||
@@ -46,14 +53,14 @@ next:
|
||||
}
|
||||
ffListDestroy(&users);
|
||||
|
||||
if(instance->config.uptime.outputFormat.length == 0)
|
||||
if(instance->config.users.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, FF_USERS_MODULE_NAME, 0, &instance->config.uptime.key);
|
||||
ffPrintLogoAndKey(instance, FF_USERS_MODULE_NAME, 0, &instance->config.users.key);
|
||||
puts(result.chars);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormat(instance, FF_USERS_MODULE_NAME, 0, &instance->config.uptime, FF_USERS_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
ffPrintFormat(instance, FF_USERS_MODULE_NAME, 0, &instance->config.users, FF_USERS_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user