From 0c682b3cd66c3483a35e3eb78ccdce966b199827 Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Sat, 1 Aug 2020 02:47:03 +0300 Subject: [PATCH] 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. --- packages/termux-tools/build.sh | 2 +- packages/termux-tools/pkg | 46 ++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/packages/termux-tools/build.sh b/packages/termux-tools/build.sh index 2244eeec0..d99b4c04f 100644 --- a/packages/termux-tools/build.sh +++ b/packages/termux-tools/build.sh @@ -1,7 +1,7 @@ TERMUX_PKG_HOMEPAGE=https://termux.com/ TERMUX_PKG_DESCRIPTION="Basic system tools for Termux" TERMUX_PKG_LICENSE="GPL-3.0" -TERMUX_PKG_VERSION=0.89 +TERMUX_PKG_VERSION=0.90 TERMUX_PKG_SKIP_SRC_EXTRACT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_ESSENTIAL=true diff --git a/packages/termux-tools/pkg b/packages/termux-tools/pkg index 95cafa350..fd73978a4 100755 --- a/packages/termux-tools/pkg +++ b/packages/termux-tools/pkg @@ -2,21 +2,41 @@ set -e -u 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 '' + echo echo 'A tool for managing packages. Commands:' - echo '' - echo ' autoclean - remove all outdated packages from .deb package cache' - echo " clean - remove all packages from .deb package cache: $(du -sh /data/data/com.termux/cache/apt/archives | cut -f1) now used" - echo ' files - show all files installed by packages' - echo ' install ' - echo ' list-all' - echo ' list-installed' - echo ' reinstall - reinstall specified installed packages at the latest version' - echo ' search ' - echo ' show - show basic metadata, such as dependencies' - echo ' uninstall ' - echo ' upgrade - update all installed packages to latest version' + echo + echo ' autoclean - Remove all outdated packages from .deb package' + echo ' cache.' + echo + echo ' clean - Remove all packages from .deb package cache.' + [ -n "$cache_size" ] && echo " Using ${cache_size} now." + echo + echo ' files - Show all files installed by packages.' + echo + echo ' install - Install specified packages.' + echo + echo ' list-all - List all packages available in repositories.' + echo + echo ' list-installed - List installed packages.' + echo + echo ' reinstall - Reinstall specified installed packages at the' + echo ' latest version.' + echo + echo ' search - Search package by query, for example by name or' + echo ' description part.' + echo + echo ' show - Show basic metadata, such as dependencies.' + echo + echo ' uninstall - 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 }