Packages (Linux): try detecting pkgtool

fix #486
This commit is contained in:
李通洲
2023-07-03 23:18:36 +08:00
parent be5a782598
commit cf91981d49
7 changed files with 10 additions and 4 deletions
+1
View File
@@ -16,6 +16,7 @@ Features:
* Support `--colors-symbol` and `--colors-padding-left`
* Add LM (Login Manager) module
* Add `--wmi-timeout` option (Windows)
* Support `pkgtool` package manager detection (Linux, Packages)
# 1.12.1
+1 -1
View File
@@ -100,7 +100,7 @@ AlmaLinux, Alpine, Android, Arch, Arco, Artix, Bedrock, BSD, CachyOS, CentOS, CR
##### Package managers
```
apk, brew, Chocolatey, dpkg, emerge, eopkg, Flatpak, MacPorts, nix, Pacman, pkg, rpm, scoop, Snap, xbps
apk, brew, Chocolatey, dpkg, emerge, eopkg, Flatpak, MacPorts, nix, Pacman, pkg, pkgtool, rpm, scoop, Snap, xbps
```
##### WM themes
+1 -1
View File
@@ -3,7 +3,7 @@
--kernel-format Sysname: {}; Release: {}; Version: {}
--uptime-format Days: {}; Hours: {}; Minutes: {}; Seconds: {}
--processes-format Count: {}
--packages-format All: {}; pacman: {}; pacman branch: {}; dpkg: {}; rpm: {}; emerge: {}; eopkg: {}; xbps: {}; apk: {}; flatpak-system: {}; flatpak-user: {}; snap: {}; brew: {}; brew-cask: {}; port: {}; scoop: {}; choco: {}
--packages-format All: {}; pacman: {}; pacman branch: {}; dpkg: {}; rpm: {}; emerge: {}; eopkg: {}; xbps: {}; apk: {}; flatpak-system: {}; flatpak-user: {}; snap: {}; brew: {}; brew-cask: {}; port: {}; scoop: {}; choco: {}; pkgtool: {}
--shell-format Process name: {}; Process path: {}; Process exe: {}; Process version: {}; User path: {}; User exe: {}; User version: {}
--display-format Width: {}; Height: {}; Refresh rate: {}; ScaledWith: {}; ScaledHeight: {}
--de-format Process name: {}; Pretty name: {}; Version: {}
+1
View File
@@ -21,6 +21,7 @@ typedef struct FFPackagesResult
uint32_t nixUser;
uint32_t pacman;
uint32_t pkg;
uint32_t pkgtool;
uint32_t port;
uint32_t rpm;
uint32_t scoop;
+1
View File
@@ -270,6 +270,7 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts)
packageCounts->nixSystem += getNixPackages(baseDir, "/run/current-system");
packageCounts->pacman += getNumElements(baseDir, "/var/lib/pacman/local", DT_DIR);
packageCounts->pkg += getSQLite3Int(baseDir, "/var/db/pkg/local.sqlite", "SELECT count(id) FROM packages");
packageCounts->pkgtool += getNumElements(baseDir, "/var/log/packages", DT_DIR);
packageCounts->rpm += getSQLite3Int(baseDir, "/var/lib/rpm/rpmdb.sqlite", "SELECT count(blob) FROM Packages");
packageCounts->snap += getSnap(baseDir);
packageCounts->xbps += getXBPS(baseDir, "/var/db/xbps");
+3 -2
View File
@@ -139,7 +139,7 @@ static inline void printCommandHelp(const char* command)
}
else if(ffStrEqualsIgnCase(command, "packages-format"))
{
constructAndPrintCommandHelpFormat("packages", "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (port), {20} (scoop), {21} (choco)", 21,
constructAndPrintCommandHelpFormat("packages", "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (port), {20} (scoop), {21} (choco), {22} (pkgtool)", 22,
"Number of all packages",
"Number of pacman packages",
"Pacman branch on manjaro",
@@ -160,7 +160,8 @@ static inline void printCommandHelp(const char* command)
"Number of brew-cask packages",
"Number of macports packages",
"Number of scoop packages",
"Number of choco packages"
"Number of choco packages",
"Number of pkgtool packages"
);
}
else if(ffStrEqualsIgnCase(command, "shell-format"))
+2
View File
@@ -61,6 +61,7 @@ void ffPrintPackages(FFPackagesOptions* options)
FF_PRINT_PACKAGE(port)
FF_PRINT_PACKAGE(scoop)
FF_PRINT_PACKAGE(choco)
FF_PRINT_PACKAGE(pkgtool)
putchar('\n');
}
@@ -88,6 +89,7 @@ void ffPrintPackages(FFPackagesOptions* options)
{FF_FORMAT_ARG_TYPE_UINT, &counts.port},
{FF_FORMAT_ARG_TYPE_UINT, &counts.scoop},
{FF_FORMAT_ARG_TYPE_UINT, &counts.choco},
{FF_FORMAT_ARG_TYPE_UINT, &counts.pkgtool},
});
}