Skip to content
Extraits de code Groupes Projets
Valider d6451f44 rédigé par Tigriz's avatar Tigriz
Parcourir les fichiers

Handle multiple directory args

parent 135a95e2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -12,20 +12,24 @@ slugify () { ...@@ -12,20 +12,24 @@ slugify () {
} }
# Checking params # Checking params
if test $# != 3 ; then if test $# -lt 3 ; then
echo 1>&2 "$0:FATAL: $# invalid argument number (expected 3)" echo 1>&2 "$0:FATAL: $# invalid argument number (expected 3)"
exit 1 exit 1
fi fi
# Checking if ImageMagick is installed # Checking if ImageMagick is installed
if ! command -v convert && ! command -v montage &> /dev/null; then if ! command -v convert &> /dev/null && ! command -v montage &> /dev/null; then
echo "$0:ERROR: magick could not be found" echo "$0:ERROR: magick could not be found"
echo "Usage : ./matrixpack.sh token homerserver directory" echo "Usage : ./matrixpack.sh token homerserver directory"
exit exit
fi fi
for i in "$@"
do
if [ -d $i ]; then
# Changing directory to work directly in it # Changing directory to work directly in it
cd "$3" cd "$i"
# Setting variables # Setting variables
dir=$(pwd) dir=$(pwd)
...@@ -86,3 +90,6 @@ echo -ne "# $packname \n![Preview of $packname](preview.png)" > "$slug/README.m ...@@ -86,3 +90,6 @@ echo -ne "# $packname \n![Preview of $packname](preview.png)" > "$slug/README.m
echo -n "]}" >> "$slug/$slug.json" echo -n "]}" >> "$slug/$slug.json"
cd - > /dev/null cd - > /dev/null
echo -e "\033[92;1mPack successfully created!\n\033[0mCheck \033[94;1m$dir/$slug \033[0mfor output" echo -e "\033[92;1mPack successfully created!\n\033[0mCheck \033[94;1m$dir/$slug \033[0mfor output"
fi
done
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter