Skip to content

hanoii/ddev-pimp-my-shell

Repository files navigation

tests project is maintained

ddev-pimp-my-shell

This a an addon that adds several nice command line utitlites I use across all projects, making it easier/nicer to work inside the container with some initial defaults.

Install

You can always install the latest code:

For DDEV v1.23.5 or above run

ddev add-on get https://github.com/hanoii/ddev-pimp-my-shell/tarball/main

For earlier versions of DDEV run

ddev get https://github.com/hanoii/ddev-pimp-my-shell/tarball/main

Contributed and maintained by @hanoii

Features

Tweaks

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
  • includes the current $PWD shortenning it.
  • shows the currently running command

i.e. for this add-on sleep 10 - ddev-pimp-my-shell/ddev: /v/w/html

ls replacement

It aliases ls and ll to use eza instead of ls.

ahoy

It bundles autocomplete for both bash and fish.

starship

If you want to use a Nerd font, there are many ways you can achieve that. I am personally editing my global ~/.ddev/global_config.yaml on the host and adding a STARSHIP_CONFIG environment variable pointing to an alternative config file which I also added to ~/.ddev/homeadditions/.config on the host with the content of this add-on's starship.toml and merging it with the output of ([directory] is in both):

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 ~/.ddev/homeadditions/.config/fish/conf.d/mytide.fish on the host with something like the following:

# Doing it as a fish_prompt event to make sure it is shown the first time it's
# run. Not sure if this is the best workaround, but otherwise the first `ddev fish`
# would show no prompt.
function mytide --on-event fish_prompt
  if not test -f ~/.config/fish/conf.d/.mytide && tide --version > /dev/null
    tide configure --auto --style=Classic --prompt_colors='True color' --classic_prompt_color=Light --show_time=No --classic_prompt_separators=Angled --powerline_prompt_heads=Sharp --powerline_prompt_tails=Flat --powerline_prompt_style='One line' --prompt_spacing=Compact --icons='Many icons' --transient=Yes
    touch ~/.config/fish/conf.d/.mytide
  end
endkkk

lazygit

It adds a config.yml diabling the startup popups.

go

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.

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 the container. Rather than downloading the database and then running ddev import-db --file= I wanted to provide a way so that either way runs all of my post-import-db commands both with the ddev import command as well as from any helper script from within the project.

So the way this works is that you can run /var/www/html/.ddev/pimp-my-shell/hooks/post-import-db.sh from any script that will be run in the container and it will take care of running all scripts on .ddev/pimp-my-shell/post-import-db.d/.

This also allows for other add-ons to add scripts to this directory so that they will be run.

Example on how I am using it: