Ein für Shopware 6 vorbereitet Systemmanagment.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

156 lines
3.4 KiB

#!/bin/bash
set -e
export TOP_PID=$$
function exit_program
{
kill -9 $TOP_PID &> /dev/null
}
### DO NOT EDIT THIS FILE
function usage {
echo
echoMainTitle "Sumedia Project Manager"
echoSmall "Manager: $project_manager_dir"
echo
echoSubTitle "Usage:"
echo
echo "project-manager [command] [command-args]"
echo "project-manager [plugin:command] [command-args]"
echo
echo "--skip-confirm with 'y' or 'n' - stops asking for action"
echo "--help Prints this message"
echo "[command] --help Prints the help message for a command"
echo "[plugin:command] --help Prints the help message for a plugin command"
echo "--list-commands List all commands"
echo "--list-commands [plugin] List all plugin commands"
echo "--list-plugins List all plugins"
echo
}
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd)/src/includes/includes"
project_manager_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd)"
function list {
local dir=$1
echo >&2
echoMainTitle "List" >&2
echo >&2
echoSubTitle "List $dir" >&2
echo >&2
dir=($(ls -t "$project_manager_dir/$dir"))
for script in "${dir[@]}"
do
echo "- $script" >&2
done
echo >&2
}
help="$(getParameter "--help" false "$*")"
list_commands="$(getParameter "--list-commands" "$*")"
list_plugins="$(getParameter "--list-plugins" "$*")"
if [[ "$1" == *"--"* ]]; then key=2; else key=1; fi
param="$(eval "echo \"\$${key}\"")"
if [[ "$param" == *":"* ]]
then
command="$(echo "$param" | cut -f2 -d':')"
plugin="$(echo "$param" | cut -f1 -d':')"
else
command=$param
plugin=""
fi
if [ ! -f "$project_manager_dir/etc/config.json" ]
then
command="install-project-manager"
plugin=""
fi
if [ "$1" == "" ] && [ "$command" == "" ]
then
usage
exit
fi
if [ "$help" == true ] && [ "$command" == "" ]
then
usage
exit
fi
if [ "$help" == true ] || [ "$list_commands" == true ] || [ "$list_plugins" == true ]
then
if [ "$command" == "" ] && [ "$list_commands" == false ] && [ "$list_plugins" == false ]
then
usage
exit
elif [ "$command" != "" ] && [ "$plugin" != "" ] && [ "$help" == true ]
then
file="$project_manager_dir/plugins/$plugin/src/commands/$command"
if [ ! -f "$file" ]
then
echo
echoError "No such file or directory: $file"
echo
exit
else
source "$file" --help
exit
fi
elif [ "$command" != "" ] && [ "$help" == true ]
then
file="$project_manager_dir/src/commands/$command"
if [ ! -f "$file" ]
then
echo
echoError "No such file or directory: $file"
echo
exit
else
source "$file" --help
exit
fi
elif [ "$command" != "" ] && [ "$list_commands" == true ]
then
list "plugins/$command/src/commands"
elif [ "$list_commands" == true ]
then
list "src/commands"
elif [ "$list_plugins" == true ]
then
list "plugins"
fi
else
if [ "$plugin" != "" ]
then
file="$project_manager_dir/plugins/$plugin/src/commands/$command"
else
file="$project_manager_dir/src/commands/$command"
fi
if [ ! -f "$file" ]
then
echo
echoError "No such file or directory: $file"
echo
exit
else
if [ "${#@}" -eq 1 ]
then
source "$file" "${*:2}"
else
source "$file" "${@:2}"
fi
fi
postScript "$project_manager_dir/src/postscripts/project-manager"
fi