mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:24:58 +02:00
NetUsage: finish docs
This commit is contained in:
@@ -27,6 +27,7 @@ Features:
|
||||
* Add `-c` as a shortcut of `--load-config`. Note it was used as the shortcut of `--color` before 2.0.5
|
||||
* Support Windows Service Pack version detection (Kernel, Windows)
|
||||
* Support Debian point releases detection (OS, Linux)
|
||||
* Add new module `NetUsage` which prints network throughput (usage) of specified interface. Note this module costs about 1 second to finish.
|
||||
|
||||
Bugfixes:
|
||||
* Fix fastfetch hanging in specific environment (#561)
|
||||
|
||||
@@ -108,7 +108,7 @@ All categories not listed here should work without needing a specific implementa
|
||||
|
||||
##### Available Modules
|
||||
```
|
||||
Battery, Bios, Bluetooth, Board, Break, Brightness, Colors, Command, CPU, CPUUsage, Cursor, Custom, Date, DateTime, DE, Disk, Display, Font, Gamepad, GPU, Host, Icons, Kernel, LM, Locale, LocalIP, Media, Memory, Monitor, OpenCL, OpenGL, OS, Packages, Player, Power Adapter, Processes, PublicIP, Separator, Shell, Sound, Swap, Terminal, Terminal Font, Terminal Size, Theme, Time, Title, Uptime, Version, Vulkan, Wallpaper, Weather, Wifi, WM, WMTheme
|
||||
Battery, Bios, Bluetooth, Board, Break, Brightness, Colors, Command, CPU, CPUUsage, Cursor, Custom, Date, DateTime, DE, Disk, Display, Font, Gamepad, GPU, Host, Icons, Kernel, LM, Locale, LocalIP, Media, Memory, Monitor, NetUsage, OpenCL, OpenGL, OS, Packages, Player, Power Adapter, Processes, PublicIP, Separator, Shell, Sound, Swap, Terminal, Terminal Font, Terminal Size, Theme, Time, Title, Uptime, Version, Vulkan, Wallpaper, Weather, Wifi, WM, WMTheme
|
||||
```
|
||||
|
||||
##### Builtin logos
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
--structure Title:Separator:OS:Host:Bios:Board:Chassis:Kernel:Uptime:Processes:Packages:Shell:Display:Brightness:Monitor:LM:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Wallpaper:Terminal:TerminalFont:TerminalSize:CPU:CPUUsage:GPU:Memory:Swap:Disk:Battery:PowerAdapter:Player:Media:PublicIP:LocalIP:Wifi:DateTime:Locale:Vulkan:OpenGL:OpenCL:Users:Bluetooth:Sound:Gamepad:Weather:Version:Break:Colors
|
||||
--structure Title:Separator:OS:Host:Bios:Board:Chassis:Kernel:Uptime:Processes:Packages:Shell:Display:Brightness:Monitor:LM:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Wallpaper:Terminal:TerminalFont:TerminalSize:CPU:CPUUsage:GPU:Memory:Swap:Disk:Battery:PowerAdapter:Player:Media:PublicIP:LocalIP:Wifi:DateTime:Locale:Vulkan:OpenGL:OpenCL:Users:Bluetooth:Sound:Gamepad:Weather:NetUsage:Version:Break:Colors
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
"sound",
|
||||
"gamepad",
|
||||
"weather",
|
||||
"netusage",
|
||||
"version",
|
||||
"break",
|
||||
"colors"
|
||||
|
||||
@@ -370,6 +370,7 @@
|
||||
#--lm-key LM
|
||||
#--locale-key Locale
|
||||
#--localip-key Local IP ({1})
|
||||
#--netusage-key Net Usage ({1})
|
||||
#--publicip-key Public IP
|
||||
#--wifi-key Wifi
|
||||
#--weather-key Weather
|
||||
@@ -422,6 +423,7 @@
|
||||
#--lm-format
|
||||
#--locale-format
|
||||
#--localip-format
|
||||
#--netusage-format
|
||||
#--publicip-format
|
||||
#--weather-format
|
||||
#--monitor-format
|
||||
@@ -471,6 +473,7 @@
|
||||
#--lm-key-color
|
||||
#--locale-key-color
|
||||
#--localip-key-color
|
||||
#--netusage-key-color
|
||||
#--publicip-key-color
|
||||
#--weather-key-color
|
||||
#--monitor-key-color
|
||||
|
||||
+4
-2
@@ -147,9 +147,11 @@ Module specific options:
|
||||
--localip-show-ipv6 <?value>: Show IPv6 addresses in local ip module. Default is false
|
||||
--localip-show-mac <?value>: Show mac addresses in local ip module. Default is false
|
||||
--localip-show-loop <?value>: Show loop back addresses (127.0.0.1) in local ip module. Default is false
|
||||
--localip-name-prefix <str>: Show IPs with given name prefix only. Default is empty
|
||||
--localip-default-route-only <?value>: Show ips that are used for default routing only. Default is false
|
||||
--localip-name-prefix <str>: Show interfaces with given interface name prefix only. Default is empty
|
||||
--localip-default-route-only <?value>: Show the interface that is used for default routing only. Default is false
|
||||
--localip-compact <?value>: Show all IPs in one line. Default is false
|
||||
--netusage-name-prefix <str>: Show interfaces with given name prefix only. Default is empty
|
||||
--netusage-default-route-only <?value>: Show the interfac that is used for default routing only. Default is false
|
||||
--publicip-timeout: Time in milliseconds to wait for the public ip server to respond. Default is disabled (0)
|
||||
--publicip-url: The URL of public IP detection server to be used.
|
||||
--weather-location: Set the location to be used. It must be URI encoded (eg a whitespace must be encoded as `+`).
|
||||
|
||||
+18
-5
@@ -381,18 +381,31 @@ static inline void printCommandHelp(const char* command)
|
||||
"Locale code"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "local-ip-format"))
|
||||
else if(ffStrEqualsIgnCase(command, "localip-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("local-ip", "{}", 1,
|
||||
"Local IP address"
|
||||
constructAndPrintCommandHelpFormat("localip", "{}", 5,
|
||||
"Local IPv4 address",
|
||||
"Local IPv6 address",
|
||||
"Physical (MAC) address",
|
||||
"Interface name",
|
||||
"Is default route"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "public-ip-format"))
|
||||
else if(ffStrEqualsIgnCase(command, "publicip-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("public-ip", "{}", 1,
|
||||
constructAndPrintCommandHelpFormat("publicip", "{}", 1,
|
||||
"Public IP address"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "netusage-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("netusage", "{}", 3,
|
||||
"Size of data received per second (formatted)",
|
||||
"Size of data sent per second (formatted)",
|
||||
"Interface name",
|
||||
"Is default route"
|
||||
);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(command, "wifi-format"))
|
||||
{
|
||||
constructAndPrintCommandHelpFormat("wifi", "{4} - {6}", 3,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_LOCALIP_DISPLAY_NAME "Local IP"
|
||||
#define FF_LOCALIP_NUM_FORMAT_ARGS 2
|
||||
#define FF_LOCALIP_NUM_FORMAT_ARGS 5
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
|
||||
static int sortIps(const FFLocalIpResult* left, const FFLocalIpResult* right)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_NETUSAGE_DISPLAY_NAME "Net Usage"
|
||||
#define FF_NETUSAGE_NUM_FORMAT_ARGS 1
|
||||
#define FF_NETUSAGE_NUM_FORMAT_ARGS 12
|
||||
|
||||
static int sortInfs(const FFNetUsageIoCounters* left, const FFNetUsageIoCounters* right)
|
||||
{
|
||||
@@ -71,11 +71,15 @@ void ffPrintNetUsage(FFNetUsageOptions* options)
|
||||
{
|
||||
ffStrbufClear(&buffer2);
|
||||
ffParseSize(inf->rxBytes, &buffer);
|
||||
ffStrbufAppendS(&buffer, "/s");
|
||||
ffParseSize(inf->txBytes, &buffer2);
|
||||
ffStrbufAppendS(&buffer2, "/s");
|
||||
|
||||
ffPrintFormatString(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_NETUSAGE_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &inf->name},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &buffer2},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &inf->name},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &inf->defaultRoute},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txBytes},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxBytes},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txPackets},
|
||||
@@ -84,7 +88,6 @@ void ffPrintNetUsage(FFNetUsageOptions* options)
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txErrors},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &inf->rxDrops},
|
||||
{FF_FORMAT_ARG_TYPE_UINT64, &inf->txDrops},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &inf->defaultRoute},
|
||||
});
|
||||
}
|
||||
++index;
|
||||
@@ -178,6 +181,7 @@ void ffGenerateNetUsageJson(FFNetUsageOptions* options, yyjson_mut_doc* doc, yyj
|
||||
{
|
||||
yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "name", &counter->name);
|
||||
yyjson_mut_obj_add_bool(doc, obj, "defaultRoute", counter->defaultRoute);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "txBytes", counter->txBytes);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "rxBytes", counter->rxBytes);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "txPackets", counter->txPackets);
|
||||
@@ -186,7 +190,6 @@ void ffGenerateNetUsageJson(FFNetUsageOptions* options, yyjson_mut_doc* doc, yyj
|
||||
yyjson_mut_obj_add_uint(doc, obj, "txErrors", counter->txErrors);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "rxDrops", counter->rxDrops);
|
||||
yyjson_mut_obj_add_uint(doc, obj, "txDrops", counter->txDrops);
|
||||
yyjson_mut_obj_add_bool(doc, obj, "defaultRoute", counter->defaultRoute);
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH(FFNetUsageIoCounters, inf, result)
|
||||
|
||||
Reference in New Issue
Block a user