termux-tools: improve usage info for pkg

* Avoid long lines.
* Add missing info for some commands.
* Do not show deb cache size if its size cannot be determined, for example if cache dir was deleted.
This commit is contained in:
Leonid Pliushch 2020-08-01 02:47:03 +03:00
parent 4801874eb6
commit 0c682b3cd6
2 changed files with 34 additions and 14 deletions

View File

@ -1,7 +1,7 @@
TERMUX_PKG_HOMEPAGE=https://termux.com/ TERMUX_PKG_HOMEPAGE=https://termux.com/
TERMUX_PKG_DESCRIPTION="Basic system tools for Termux" TERMUX_PKG_DESCRIPTION="Basic system tools for Termux"
TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_VERSION=0.89 TERMUX_PKG_VERSION=0.90
TERMUX_PKG_SKIP_SRC_EXTRACT=true TERMUX_PKG_SKIP_SRC_EXTRACT=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_ESSENTIAL=true TERMUX_PKG_ESSENTIAL=true

View File

@ -2,21 +2,41 @@
set -e -u set -e -u
show_help() { show_help() {
local cache_size
cache_size=$(du -sh /data/data/com.termux/cache/apt/archives 2>/dev/null | cut -f1)
echo 'Usage: pkg command [arguments]' echo 'Usage: pkg command [arguments]'
echo '' echo
echo 'A tool for managing packages. Commands:' echo 'A tool for managing packages. Commands:'
echo '' echo
echo ' autoclean - remove all outdated packages from .deb package cache' echo ' autoclean - Remove all outdated packages from .deb package'
echo " clean - remove all packages from .deb package cache: $(du -sh /data/data/com.termux/cache/apt/archives | cut -f1) now used" echo ' cache.'
echo ' files <packages> - show all files installed by packages' echo
echo ' install <packages>' echo ' clean - Remove all packages from .deb package cache.'
echo ' list-all' [ -n "$cache_size" ] && echo " Using ${cache_size} now."
echo ' list-installed' echo
echo ' reinstall <packages> - reinstall specified installed packages at the latest version' echo ' files <packages> - Show all files installed by packages.'
echo ' search <query>' echo
echo ' show <packages> - show basic metadata, such as dependencies' echo ' install <packages> - Install specified packages.'
echo ' uninstall <packages>' echo
echo ' upgrade - update all installed packages to latest version' echo ' list-all - List all packages available in repositories.'
echo
echo ' list-installed - List installed packages.'
echo
echo ' reinstall <packages> - Reinstall specified installed packages at the'
echo ' latest version.'
echo
echo ' search <query> - Search package by query, for example by name or'
echo ' description part.'
echo
echo ' show <packages> - Show basic metadata, such as dependencies.'
echo
echo ' uninstall <packages> - Uninstall specified packages. Configuration files'
echo ' will be left intact.'
echo
echo ' upgrade - Upgrade all installed packages to the latest'
echo ' version.'
echo
exit 1 exit 1
} }