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