penpot bash script

This commit is contained in:
Bryan Ramos 2024-05-11 15:05:54 -04:00
parent 4fac97258c
commit 89acce0159
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8
3 changed files with 37 additions and 29 deletions

View file

@ -1,35 +1,6 @@
'' ''
export DIRENV_LOG_FORMAT= export DIRENV_LOG_FORMAT=
function penpot() {
case "$1" in
run)
sudo docker compose -p penpot -f ~/Documents/tools/penpot/docker-compose.yaml up -d >/dev/null 2>&1
nohup bash -c '(sleep 10 && if [[ "$OSTYPE" == "linux-gnu"* ]]; then
xdg-open "http://localhost:9001"
elif [[ "$OSTYPE" == "darwin"* ]]; then
open "http://localhost:9001"
fi)' >/dev/null 2>&1 &
echo "Started penpot on http://localhost:9001"
;;
stop)
echo "Stopping penpot"
sudo docker compose -p penpot -f ~/Documents/tools/penpot/docker-compose.yaml down >/dev/null 2>&1
;;
update)
sudo docker compose -f ~/Documents/tools/penpot/docker-compose.yaml pull
echo "Updated penpot!"
;;
help)
xdg-open "https://help.penpot.app/"
echo "Opened penpot help page in your browser."
;;
*)
echo "Usage: penpot {run|stop|update|help}"
;;
esac
}
set -o vi set -o vi
bind 'set completion-ignore-case on' bind 'set completion-ignore-case on'

View file

@ -0,0 +1,31 @@
#TODO: Create a penpot derivation and properly fix the script
''
function penpot() {
case "$1" in
run)
sudo docker compose -p penpot -f ~/Documents/tools/penpot/docker-compose.yaml up -d >/dev/null 2>&1
nohup bash -c '(sleep 10 && if [[ "$OSTYPE" == "linux-gnu"* ]]; then
xdg-open "http://localhost:9001"
elif [[ "$OSTYPE" == "darwin"* ]]; then
open "http://localhost:9001"
fi)' >/dev/null 2>&1 &
echo "Started penpot on http://localhost:9001"
;;
stop)
echo "Stopping penpot"
sudo docker compose -p penpot -f ~/Documents/tools/penpot/docker-compose.yaml down >/dev/null 2>&1
;;
update)
sudo docker compose -f ~/Documents/tools/penpot/docker-compose.yaml pull
echo "Updated penpot!"
;;
help)
xdg-open "https://help.penpot.app/"
echo "Opened penpot help page in your browser."
;;
*)
echo "Usage: penpot {run|stop|update|help}"
;;
esac
}
''

View file

@ -14,6 +14,12 @@ in
pkg-config pkg-config
qrencode qrencode
docker
]; ];
programs.bash.initExtra = mkAfter ''
${import ./config/penpot.nix}
'';
}; };
} }