diff --git a/.ddev/addon-metadata/pimp-my-shell/manifest.yaml b/.ddev/addon-metadata/pimp-my-shell/manifest.yaml index c35456c..fd97137 100644 --- a/.ddev/addon-metadata/pimp-my-shell/manifest.yaml +++ b/.ddev/addon-metadata/pimp-my-shell/manifest.yaml @@ -1,7 +1,7 @@ name: pimp-my-shell repository: . version: "" -install_date: "2024-11-26T15:10:58-03:00" +install_date: "2024-11-27T13:07:28-03:00" project_files: - web-build/Dockerfile.pimp-my-shell - homeadditions/.bashrc.d/pimp-my-shell.sh @@ -10,6 +10,7 @@ project_files: - commands/web/gum - commands/web/lazygit - commands/host/fish + - homeadditions/.local/bin/xdebug - homeadditions/.local/share/bash-completion/completions/ahoy - homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish - homeadditions/.config/starship.toml diff --git a/.ddev/homeadditions/.local/bin/xdebug b/.ddev/homeadditions/.local/bin/xdebug new file mode 100755 index 0000000..331eb68 --- /dev/null +++ b/.ddev/homeadditions/.local/bin/xdebug @@ -0,0 +1,30 @@ +#!/bin/bash +#ddev-generated + +set -e -o pipefail + +enable=0 +disable=0 +if [ ! -f "/tmp/ddev-pimp-my-shell-xdebug" ]; then + if [ "$DDEV_XDEBUG_ENABLED" == "false" ]; then + enable=1 + else + disable=1 + fi +else + if [ $(cat /tmp/ddev-pimp-my-shell-xdebug) == "0" ]; then + enable=1 + else + disable=1 + fi +fi + +if [ $enable -eq 1 ]; then + enable_xdebug + echo -n "1" > /tmp/ddev-pimp-my-shell-xdebug +fi + +if [ $enable -eq 0 ]; then + disable_xdebug + echo -n "0" > /tmp/ddev-pimp-my-shell-xdebug +fi diff --git a/README.md b/README.md index 2f7c57e..fff62f8 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ defaults. - [Install](#install) - [Features](#features) - [Tweaks](#tweaks) + * [xdebug command inside the container](#xdebug-command-inside-the-container) * [terminal window title](#terminal-window-title) * [ls replacement](#ls-replacement) * [ahoy](#ahoy) @@ -19,7 +20,7 @@ defaults. * [fish](#fish) * [lazygit](#lazygit) * [go](#go) - * [ddev `post-import-db` hook](#ddev-post-import-db-hook) + * [DDEV `post-import-db` hook](#ddev-post-import-db-hook) @@ -65,13 +66,26 @@ ddev get https://github.com/hanoii/ddev-pimp-my-shell/tarball/main ## Tweaks +### xdebug command inside the container + +While you can enable xdebug by following the [DDEV guide][ddev-xdebug], I am +normally inside the container. + +I found that you can use DDEV's own `enable_xdebug` and `disable_xdebug` inside +the container but I wanted a shortcut to that so this add-on +[ships a small script](homeadditions/.local/bin/xdebug) that simply toggles +xdebug state by running `xdebug` inside the container. + +[ddev-xdebug]: + https://ddev.readthedocs.io/en/stable/users/debugging-profiling/step-debugging/ + ### terminal window title Both for bash and fish, this add-on changes the window terminal with a better default if working inside the container: -- Adds the ddev project name -- shows that is a ddev project +- Adds the DDEV project name +- shows that is a DDEV project - includes the current $PWD shortenning it. - shows the currently running command @@ -103,7 +117,7 @@ starship preset nerd-font-symbols ### fish For tide, it uses the default configuration, if you want to have your own on all -of your ddev projects you can create/edit +of your DDEV projects you can create/edit `~/.ddev/homeadditions/.config/fish/conf.d/mytide.fish` on the host with something like the following: @@ -129,9 +143,9 @@ startup popups. Other than adding itself to the path and installing some packages I am unsetting `GOARCH` and `GOOS` for both `ddev ssh` and `ddev fish` so that are not in conflict with the container OS as -[they are added by ddev from the host](https://github.com/ddev/ddev/issues/6748). +[they are added by DDEV from the host](https://github.com/ddev/ddev/issues/6748). -### ddev `post-import-db` hook +### DDEV `post-import-db` hook I generally have import scripts that I ship either from other add-ons or specific to projects and those scripts usually download the database from within diff --git a/homeadditions/.local/bin/xdebug b/homeadditions/.local/bin/xdebug new file mode 100755 index 0000000..331eb68 --- /dev/null +++ b/homeadditions/.local/bin/xdebug @@ -0,0 +1,30 @@ +#!/bin/bash +#ddev-generated + +set -e -o pipefail + +enable=0 +disable=0 +if [ ! -f "/tmp/ddev-pimp-my-shell-xdebug" ]; then + if [ "$DDEV_XDEBUG_ENABLED" == "false" ]; then + enable=1 + else + disable=1 + fi +else + if [ $(cat /tmp/ddev-pimp-my-shell-xdebug) == "0" ]; then + enable=1 + else + disable=1 + fi +fi + +if [ $enable -eq 1 ]; then + enable_xdebug + echo -n "1" > /tmp/ddev-pimp-my-shell-xdebug +fi + +if [ $enable -eq 0 ]; then + disable_xdebug + echo -n "0" > /tmp/ddev-pimp-my-shell-xdebug +fi diff --git a/install.yaml b/install.yaml index 047748f..e27195b 100644 --- a/install.yaml +++ b/install.yaml @@ -7,6 +7,7 @@ project_files: - commands/web/gum - commands/web/lazygit - commands/host/fish + - homeadditions/.local/bin/xdebug - homeadditions/.local/share/bash-completion/completions/ahoy - homeadditions/.local/share/fish/vendor_completions.d/ahoy.fish - homeadditions/.config/starship.toml