Commit bc73fd90 authored by Boria138's avatar Boria138 Committed by Vitaly Lipatov

epm packages: add --last argument (eterbug #17253)

parent 54b799ab
......@@ -200,6 +200,7 @@ case $PROGNAME in
;;
epmqa) # HELPSHORT: alias for epm packages
epm_cmd=packages
direct_args=1
;;
epmqp) # HELPSHORT: alias for epm qp (epm query package)
epm_cmd=query_package
......@@ -564,10 +565,6 @@ check_option()
--url) # HELPOPT: print only URL instead of download package
print_url="--url"
;;
--sort) # HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
# TODO: how to read arg?
sort="$1"
;;
-y|--auto|--assumeyes|--non-interactive|--disable-interactivity) # HELPOPT: non interactive mode
non_interactive="--auto"
interactive=""
......
......@@ -19,9 +19,21 @@
load_helper epm-sh-warmup
__epm_packages_help()
{
echo "package management list"
get_help HELPCMD $SHAREDIR/epm-packages
cat <<EOF
Examples:
epm packages --sort
epm packages --sort=size
epm packages --last
EOF
}
__epm_packages_sort()
{
# FIXME: sort depends on --sort value
case $PMTYPE in
*-rpm)
# FIXME: space with quotes problems, use point instead
......@@ -38,6 +50,24 @@ case $PMTYPE in
esac
}
__epm_packages_last()
{
case $PMTYPE in
*-rpm)
# FIXME: space with quotes problems, use point instead
warmup_rpmbase
docmd rpm -qa --last
;;
pacman)
assure_exists expac
docmd expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl
;;
*)
fatal "Last package list function is not implemented for $PMTYPE"
;;
esac
}
__aptcyg_print_full()
{
#showcmd apt-cyg show
......@@ -54,7 +84,25 @@ __fo_pfn()
epm_packages()
{
local CMD
[ -n "$sort" ] && __epm_packages_sort "$@" && return
case "$1" in
-h|--help|help) # HELPCMD: help
__epm_packages_help
return
;;
--sort=size|--sort) # HELPCMD: list package(s) by size, most
__epm_packages_sort
return
;;
--last|--sort=time) # HELPCMD: list package(s) by install time, most
__epm_packages_last
return
;;
"")
;;
*)
fatal "Unknown option $1. Use epm packages --help to get help."
esac
case $PMTYPE in
*-dpkg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment