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

Manage all homeserver and token conf at the same time

Also allow change of stickerpicker repository.

This fixes `stpkg pack` accepting token with `-t` but not `stpkg edit`
parent 9e2f3382
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -72,10 +72,6 @@ if [ "x$STPKG_NO_MSG" = "xyes" -a ! "x$1" = "x-install" -a ! "x$1" = "xupdate" ]
info() { return 0; }
fi
# Home server
STPKG_HOMESERV=${STPKG_HOMESERV:="matrix.org"}
STPKG_HOMESERV=`echo "$STPKG_HOMESERV" | iconv -c -t ascii//TRANSLIT | sed -e 's/^http:\/\/|^https:\/\///g' -e 's/^-+|-+$//g'`
########################
# Some basic functions #
########################
......@@ -90,15 +86,15 @@ usage() {
echo `__bold "$BASE_NAME usage:"`
local BASE_NAME=`__green "$BASE_NAME"`
cat << EOF
$BASE_NAME -install [`__yellow "-sshfs 'username@server' -local mnt_point"`] [`__yellow "install_path"`]
$BASE_NAME -install [`__yellow "-sshfs 'username@server' -local mnt_point -pickerrepo 'foo@git.fr:stickerpicker.git'"`] [`__yellow "install_path"`]
$BASE_NAME show
$BASE_NAME help
$BASE_NAME update
$BASE_NAME list [`__yellow "-p -e -np"`] [`__yellow "bash_regex"`]
$BASE_NAME add|del <`__yellow "pack"`>
$BASE_NAME pack [`__yellow "-t token"`] [`__yellow "name"`] <`__yellow "pack_folder"`>
$BASE_NAME edit [`__yellow "-t token"`] <`__yellow "pack_name"`> add|del <`__yellow "sticker"`> [`__yellow "file"`]
$BASE_NAME display [`__yellow "-dl folder"`] <`__yellow "pack_name"`> [`__yellow "sticker_regex"`]
$BASE_NAME edit <`__yellow "pack_name"`> add|del <`__yellow "sticker"`> [`__yellow "file"`]
`__bold Flags:`
`__yellow "-e"` / `__yellow "-ne"` The pack is enabled / disabled
......@@ -252,6 +248,10 @@ __install() {
local PARSE_FLAGS=1
while [ $PARSE_FLAGS -eq 1 ]; do
case "$1" in
-pickerrepo)
STPKG_STICKER_REPO="$2"
shift 2
;;
-sshfs)
local SSHFS="$2"
shift 2
......@@ -662,20 +662,6 @@ progress() { echo 1>&2 -n "$*"; }
progress_dot() { progress '.'; }
progress_reset() { echo 1>&2 -en "\r"; }
__pack() {
validate_homeserv # Check if homeserv exists
# Get the token
if [ "x$1" = "x-t" ]; then
STPKG_TOKEN="$2"
shift 2
fi
if [ "x$STPKG_TOKEN" = "x" ]; then
read -sp "`__yellow 'Enter your access token:'`" STPKG_TOKEN
echo ''
fi
validate_token # Validate token, will exit if invalid
# The pack source folder and the pack name
if [ $# -eq 1 ]; then
# The pack name is not specified
......@@ -796,8 +782,30 @@ __do_command() {
info "Using STPKG_INSTALL: $STPKG_INSTALL`[ "x$STPKG_SSHFS" = "xyes" ] && echo ' (this is an sshfs install)'`"
[ "x$STPKG_BASE" = "x" ] && die \
"The STPKG_BASE env var is mendatory, it must point to the sticker repo. It should have been given by the install script"
;;
"The STPKG_BASE env var is mandatory, it must point to the sticker repo. It should have been given by the install script"
STPKG_STICKER_REPO=${STPKG_STICKER_REPO:="https://github.com/maunium/stickerpicker.git"}
;;&
edit|pack)
# Home server
STPKG_HOMESERV=${STPKG_HOMESERV:="matrix.org"}
STPKG_HOMESERV=`echo "$STPKG_HOMESERV" | iconv -c -t ascii//TRANSLIT | sed -e 's/^http:\/\/|^https:\/\///g' -e 's/^-+|-+$//g'`
validate_homeserv # Check if homeserv exists
# Get the token
if [ "x$1" = "x-t" ]; then
STPKG_TOKEN="$2"
shift 2
fi
if [ "x$STPKG_TOKEN" = "x" ]; then
read -sp "`__yellow 'Enter your access token:'`" STPKG_TOKEN
echo ''
fi
validate_token # Validate token, will exit if invalid
;;&
*)
;;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter