generated from ddev/ddev-addon-template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Looks good, passes test, thanks!
- Loading branch information
Showing
5 changed files
with
68 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
## #ddev-generated: If you want to edit and own this file, remove this line. | ||
## Description: Launch a browser with Adminer | ||
## Usage: adminer | ||
## Example: "ddev adminer" | ||
|
||
DDEV_ADMINER_PORT=9100 | ||
DDEV_ADMINER_HTTPS_PORT=9101 | ||
|
||
FULLURL=${DDEV_PRIMARY_URL} | ||
HTTPS="" | ||
if [ ${DDEV_PRIMARY_URL%://*} = "https" ]; then HTTPS=true; fi | ||
|
||
if [[ ! -z "${GITPOD_INSTANCE_ID}" ]] || [[ "${CODESPACES}" == "true" ]]; then | ||
FULLURL="${FULLURL/-${DDEV_HOST_WEBSERVER_PORT}/-${DDEV_ADMINER_PORT}}" | ||
else | ||
if [ "${HTTPS}" = "" ]; then | ||
FULLURL="${FULLURL%:[0-9]*}:${DDEV_ADMINER_PORT}" | ||
else | ||
FULLURL="${FULLURL%:[0-9]*}:${DDEV_ADMINER_HTTPS_PORT}" | ||
fi | ||
fi | ||
|
||
if [ -n "${1:-}" ] ; then | ||
if [[ ${1::1} != "/" ]] ; then | ||
FULLURL="${FULLURL}/"; | ||
fi | ||
|
||
FULLURL="${FULLURL}${1}"; | ||
fi | ||
|
||
if [ "${DDEV_DEBUG:-}" = "true" ]; then | ||
printf "FULLURL $FULLURL\n" && exit 0 | ||
fi | ||
|
||
case $OSTYPE in | ||
linux-gnu) | ||
if [[ ! -z "${GITPOD_INSTANCE_ID}" ]]; then | ||
gp preview ${FULLURL} | ||
else | ||
xdg-open ${FULLURL} | ||
fi | ||
;; | ||
"darwin"*) | ||
open ${FULLURL} | ||
;; | ||
"win*"* | "msys"*) | ||
start ${FULLURL} | ||
;; | ||
esac | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,6 @@ | ||
#!/bin/bash | ||
|
||
#ddev-generated | ||
## Description: Launch a browser with the current site | ||
## Usage: launcha [path] [-a|--adminer] [-p|--phpmyadmin] [-m|--mailhog] | ||
## Example: "ddev launcha" or "ddev launcha /admin/reports/status/php" or "ddev launcha phpinfo.php", for Adminer "ddev launcha -a", MailHog "ddev launch -m" | ||
|
||
FULLURL=${DDEV_PRIMARY_URL} | ||
HTTPS="" | ||
if [ ${DDEV_PRIMARY_URL%://*} = "https" ]; then HTTPS=true; fi | ||
|
||
while :; do | ||
case ${1:-} in | ||
-h|-\?|--help) | ||
show_help | ||
exit | ||
;; | ||
-a|--adminer) | ||
if [ "${HTTPS}" = "" ]; then | ||
FULLURL="${FULLURL%:[0-9]*}:9100" | ||
else | ||
FULLURL="${FULLURL%:[0-9]*}:9101" | ||
fi | ||
;; | ||
-p|--phpmyadmin) | ||
if [ "${HTTPS}" = "" ]; then | ||
FULLURL="${FULLURL%:[0-9]*}:${DDEV_PHPMYADMIN_PORT}" | ||
else | ||
FULLURL="${FULLURL%:[0-9]*}:${DDEV_PHPMYADMIN_HTTPS_PORT}" | ||
fi | ||
;; | ||
-m|--mailhog) | ||
if [ "${HTTPS}" = "" ]; then | ||
FULLURL="${FULLURL%:[0-9]*}:${DDEV_MAILHOG_PORT}" | ||
else | ||
FULLURL="${FULLURL%:[0-9]*}:${DDEV_MAILHOG_HTTPS_PORT}" | ||
fi | ||
;; | ||
|
||
--) # End of all options. | ||
shift | ||
break | ||
;; | ||
-?*) | ||
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2 | ||
;; | ||
*) # Default case: No more options, so break out of the loop. | ||
break | ||
esac | ||
|
||
shift | ||
done | ||
|
||
if [ -n "${1:-}" ] ; then | ||
if [[ ${1::1} != "/" ]] ; then | ||
FULLURL="${FULLURL}/"; | ||
fi | ||
|
||
FULLURL="${FULLURL}${1}"; | ||
fi | ||
|
||
if [ ! -z ${DDEV_DEBUG:-} ]; then | ||
printf "FULLURL $FULLURL\n" && exit 0 | ||
fi | ||
|
||
case $OSTYPE in | ||
linux-gnu) | ||
xdg-open ${FULLURL} | ||
;; | ||
"darwin"*) | ||
open ${FULLURL} | ||
;; | ||
"win*"* | "msys"*) | ||
start ${FULLURL} | ||
;; | ||
esac | ||
## Description: DEPRECATED, use "ddev adminer" instead. | ||
printf "'ddev launcha' is no longer available. Use 'ddev launch' and 'ddev adminer' instead. See https://github.com/ddev/ddev-adminer" | ||
exit 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ project_files: | |
- adminer | ||
|
||
global_files: | ||
- commands/host/adminer | ||
- commands/host/launcha |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters