Skip to content

Commit b52dcd4

Browse files
mikeericksonphiltrep
authored andcommitted
540 added alias support (laradock#557)
* 540 added alias support * Updated aliases, added content to README.md
1 parent 4c8e095 commit b52dcd4

3 files changed

Lines changed: 99 additions & 2 deletions

File tree

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to
8787
- [Install Prestissimo](#Install-Prestissimo)
8888
- [Install Node + NVM](#Install-Node)
8989
- [Install Node + YARN](#Install-Yarn)
90-
- [Install Linuxbrew](#Install-Brew)
90+
- [Install Linuxbrew](#Install-Linuxbrew)
91+
- [Common Terminal Aliases](#Common-Aliases)
9192
- [Debugging](#debugging)
9293
- [Upgrading LaraDock](#upgrading-laradock)
9394
- [Related Projects](#related-projects)
@@ -189,12 +190,14 @@ That's it! enjoy :)
189190
- PHP7-CLI
190191
- Composer
191192
- Git
193+
- Linuxbrew
192194
- Node
193195
- Gulp
194196
- SQLite
195197
- xDebug
196198
- Envoy
197199
- Vim
200+
- Yarn
198201
- ... Many other supported tools are not documented. (Will be updated soon)
199202
200203
>If you can't find your Software, build it yourself and add it to this list. Contributions are welcomed :)
@@ -410,7 +413,8 @@ You can select your own combination of Containers form the list below:
410413
```bash
411414
docker-compose exec workspace bash
412415
```
413-
Alternatively, for Windows Powershell users: execute the following command to enter any running container:
416+
417+
Alternativey, for Windows Powershell users: execute the following command to enter any running container:
414418
415419
```bash
416420
docker exec -it {workspace-container-id} bash
@@ -1552,6 +1556,17 @@ It should be like this:
15521556

15531557

15541558

1559+
<br>
1560+
<a name="Common-Aliases"></a>
1561+
<br>
1562+
### Common Terminal Aliases
1563+
When you start your docker container, Laradock will copy the `aliases.sh` file located in the `laradock/workspace` directory and add sourcing to the container `~/.bashrc` file.
1564+
1565+
You are free to modify the `aliases.sh` as you see fit, adding your own aliases (or function macros) to suit your requirements.
1566+
1567+
1568+
1569+
15551570

15561571
<br>
15571572
<a name="Install-Aerospike-Extension"></a>

workspace/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ USER root
8282
COPY ./crontab /etc/cron.d
8383
RUN chmod -R 644 /etc/cron.d
8484

85+
#####################################
86+
# User Aliases
87+
#####################################
88+
USER root
89+
90+
COPY ./aliases.sh /home/laradock/aliases.sh
91+
RUN echo "" >> ~/.bashrc
92+
RUN echo "# Load Custom Aliases" >> ~/.bashrc
93+
RUN echo "source /home/laradock/aliases.sh" >> ~/.bashrc
94+
RUN echo "" >> ~/.bashrc
95+
8596
#####################################
8697
# xDebug:
8798
#####################################

workspace/aliases.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#! /bin/sh
2+
3+
# Colors used for status updates
4+
ESC_SEQ="\x1b["
5+
COL_RESET=$ESC_SEQ"39;49;00m"
6+
COL_RED=$ESC_SEQ"31;01m"
7+
COL_GREEN=$ESC_SEQ"32;01m"
8+
COL_YELLOW=$ESC_SEQ"33;01m"
9+
COL_BLUE=$ESC_SEQ"34;01m"
10+
COL_MAGENTA=$ESC_SEQ"35;01m"
11+
COL_CYAN=$ESC_SEQ"36;01m"
12+
13+
# Commonly Used Aliases
14+
alias ..="cd .."
15+
alias c="clear"
16+
alias cla="clear && ls -l"
17+
alias cll="clear && ls -la"
18+
alias cls="clear && ls"
19+
alias code="cd /var/www"
20+
alias ea="vi ~/aliases"
21+
alias g="gulp"
22+
alias home="cd ~"
23+
alias npm-global="npm list -g --depth 0"
24+
alias ra="reload"
25+
alias reload="source ~/.aliases && echo \"$COL_GREEN ==> Aliases Reloaded... $COL_RESET \n \""
26+
alias run="npm run"
27+
alias tree="xtree"
28+
29+
# Laravel / PHP Alisases
30+
alias art="php artisan"
31+
alias artisan="php artisan"
32+
alias cdump="composer dump-autoload -o"
33+
alias composer:dump="composer dump-autoload -o"
34+
alias db:reset="php artisan migrate:reset && php artisan migrate --seed"
35+
alias migrate="php artisan migrate"
36+
alias seed="php artisan:seed"
37+
alias phpunit="./vendor/bin/phpunit"
38+
39+
40+
# requires installation of 'https://www.npmjs.com/package/npms-cli'
41+
alias npms="npms search"
42+
43+
# requires installation of 'https://www.npmjs.com/package/package-menu-cli'
44+
alias pm="package-menu"
45+
46+
# requires installation of 'https://www.npmjs.com/package/pkg-version-cli'
47+
alias pv="package-version"
48+
49+
# requires installation of 'https://github.com/sindresorhus/latest-version-cli'
50+
alias lv="latest-version"
51+
52+
# git aliases
53+
alias gaa="git add ."
54+
alias gd="git --no-pager diff"
55+
alias git-revert="git reset --hard && git clean -df"
56+
alias gs="git status"
57+
alias whoops="git reset --hard && git clean -df"
58+
59+
60+
# Create a new directory and enter it
61+
function mkd() {
62+
mkdir -p "$@" && cd "$@"
63+
}
64+
65+
function md() {
66+
mkdir -p "$@" && cd "$@"
67+
}
68+
69+
function xtree {
70+
find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
71+
}

0 commit comments

Comments
 (0)