Can I add e.g. aliases only once for multiple containers with ddev? - bash

I have several projects where I use ddev. I want to configure bash-scripts and aliases like
alias ll="ls -lh"
for all projects. How can I do this?
My ddev Version is 1.14.2 and I am on a MAC with Bash 5.0.11 configured on my terminal.
I know if I use .ddev/homeadditions/.bash_aliases I have all aliases, which I configure in .bash_aliases, but I don't want to configure it again and again for each project.

DRUD did it. In Version 1.15 you can now add eg. global aliases or whatever you like, that matches .bash_profile .profile or other dotfiles in the home directory.
You just have to move or copy the file:
~/.ddev/homeadditions/bash_aliases.example to ~/.ddev/homeadditions/.bash_aliases
and add your aliasses there.
Now, if your container already runs, use ddev restart to "copy" the global aliasfile to the specific container.
If you need functions you can use that file too, like:
function test() {
clear
echo "Some text"
ls -lha
}
Thanks to #rfay

Related

In DDEV how to automatically use custom shell config inside docker container?

In lieu of manually setting up my dotfiles (.bashrc, .inputrc, .vim & .vimrc etc) inside the docker container that DDEV creates... isn't there a way to automatically do this from the ddev config? I swear I saw this somewhere (maybe a blog post?) and I've been looking through https://ddev.readthedocs.io and websearching but can't find it described anywhere. Do I need to do docker cp ... or is there a ddev way?
Yes, you can provide custom in-web-container configuration using homeadditions, see docs. You can either add new configuration (anything you want in your home directory) per-project (by putting in your project's .ddev/homeadditions) or globally (by putting in the global ~/.ddev/homeadditions).
There's a blog example of doing this (from before you could do it globally in v1.15+) showing setting up oh-my-zsh, https://www.ddev.com/ddev-local/oh-my-zsh-using-custom-commands-and-other-goodies-to-add-to-ddev/

enable certain commands in root level of a project without writing script nor manual setup for local machine

Currenly, if I want to run something like start in a project, let say /myproject I have to make a new bash file and name it like start in order to have some sort of command like ./start to work properly.
But I want to do is somehow I can add some sort of config file into the root folder to run all different kinds of command without ./ needed and simply start or anything else as I want to make, without having to create whole bunch of bash files.
Is there a way to setup it so if someone just pull a git repo down can just have it?
Assume that the git repo also contains package.json or maybe gradle.
However, I dont want to use npm run xxx or gradle xxx its just too much typing...
Sorry if I am asking too much for a setup lol

how to configure cygwin Local Package Directory

I have to change my cygwin Local Package Directory, which happen to be earlier as C:\Users\username\Downloads.
Folders like http%3a%2f%2fcygwin.mirror.constant.com%2f are all in place in my new directory for Local Package Directory.
How to do that? (I cannot find, where cygwin stores the config.)
Running setup from new location tries to install all over again instead from continue using earlier packages from the internet.
The information is on /etc/setup/setup.rc
$ head setup.rc
last-cache
e:\downloads\cygwin_cache
last-mirror
http://mirrors.kernel.org/sourceware/cygwin/
net-method
Direct
last-action
Download,Install
mirrors-lst
....
Please note that setup just propose the settings based on last run but you can always change typing new values.

Add each Alias in separate file

I have manually installed Apache 2.4.6 on Windows for my development environment (I don't like WampServer or EasyPHP).
I want to have a separate file for each of my Alias directories, I don't want to edit httpd.conf directly each time I need a new Alias. How can I set it up so that I can include a whole directory of files?
Include can include wildcards:
Include c:\your\dir\*.conf

cakephp bake using command line in mac

i have setup the path variable in mac for cakephp to use command line baking. Everything works fine except the model gets created in a default location instead of a specific project which is just created.
that is when i write cake bake and select M[model], the model gets created but in default folder i.e.
/Applications/MAMP/htdocs/cakephp/app/Model/
instead of
/Applications/MAMP/htdocs/testApp/Model/
i also tried it by changing the directory path(i.e the basic cd command)
where am i getting wrong? How do i solve it?
If you use a different cakephp core for your project you have to set the working app path when you use the cakephp console. This can be done with the -app parameter.
example:
cake -app /Applications/MAMP/htdocs/testApp/app bake
In a unix based environment i prefer using aliases relative to the project root opposed to mapping it to a specific cake lib globally.
Dump this in your respective shell config ".profile/.bashrc/.zshrc"
# Alias functions
alias cake='app/Console/cake'
alias cakelogs='tail -f app/tmp/logs/*'
and while your in you project root
cake {cmd}
should work as expected.

Resources