Commit d9e17c53 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm play: add --installed support, cleanup

parent f5c76143
......@@ -55,14 +55,21 @@ __get_app_description()
$1 --description 2>/dev/null
}
__epm_play_run()
__check_play_script()
{
local script="$psdir/$1.sh"
shift
if [ ! -x "$script" ] ; then
fatal "Can't find executable play script $script."
fi
[ -x "$script" ]
}
__epm_play_run()
{
local script="$psdir/$1.sh"
__check_play_script "$1" || fatal "Can't find executable play script $script. Run epm play to list all available apps."
shift
# allow use EGET in the scripts
__set_EGET
......@@ -80,7 +87,7 @@ __epm_play_run()
epm_play()
{
local psdir="$CONFIGDIR/play.d"
local psdir="$(realpath $CONFIGDIR/play.d)"
if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
cat <<EOF
......@@ -112,8 +119,13 @@ if [ "$1" = "--update" ] ; then
if [ "$1" = "all" ] ; then
shift
for i in $(__list_installed_app) ; do
echo
echo "$i"
prescription="$i"
if ! __check_play_script $prescription ; then
warning "Can't find executable play script for $prescription. Try epm play --remove $prescription if you don't need it anymore."
continue
fi
__epm_play_run $prescription --run "$@"
done
exit
......@@ -128,8 +140,13 @@ if [ "$1" = "--update" ] ; then
exit
fi
if [ "$1" = "--installed" ] ; then
shift
__check_installed_app "$1"
exit
fi
if [ "$1" = "--list" ] || [ "$1" = "--installed" ] ; then
if [ "$1" = "--list" ] ; then
shift
local i
if [ -n "$short" ] ; then
......@@ -171,10 +188,11 @@ if [ "$1" = "--list-all" ] || [ -z "$*" ] ; then
done
echo
echo "run epm play"
echo " --list - to list installed only"
echo " --list-all (default) - to list all app"
echo " --remove <app> - to remove app"
echo " --update <app>|all - to update app or all installed apps"
echo " --list - list installed apps"
echo " --list-all (default) - list all apps"
echo " --remove <app> - remove <app>"
echo " --update <app>|all - update <app> or all installed apps"
echo " --installed <app> - check if the app is installed"
echo " --short (with --list) - list names only"
exit
fi
......
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