540 added alias support (#557)

* 540 added alias support

* Updated aliases, added content to README.md
This commit is contained in:
Mike Erickson 2017-01-17 16:09:05 -08:00 committed by Philippe Trépanier
parent 4c8e09526d
commit b52dcd4a19
3 changed files with 99 additions and 2 deletions

View File

@ -87,7 +87,8 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to
- [Install Prestissimo](#Install-Prestissimo)
- [Install Node + NVM](#Install-Node)
- [Install Node + YARN](#Install-Yarn)
- [Install Linuxbrew](#Install-Brew)
- [Install Linuxbrew](#Install-Linuxbrew)
- [Common Terminal Aliases](#Common-Aliases)
- [Debugging](#debugging)
- [Upgrading LaraDock](#upgrading-laradock)
- [Related Projects](#related-projects)
@ -189,12 +190,14 @@ That's it! enjoy :)
- PHP7-CLI
- Composer
- Git
- Linuxbrew
- Node
- Gulp
- SQLite
- xDebug
- Envoy
- Vim
- Yarn
- ... Many other supported tools are not documented. (Will be updated soon)
>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:
```bash
docker-compose exec workspace bash
```
Alternatively, for Windows Powershell users: execute the following command to enter any running container:
Alternativey, for Windows Powershell users: execute the following command to enter any running container:
```bash
docker exec -it {workspace-container-id} bash
@ -1552,6 +1556,17 @@ It should be like this:
<br>
<a name="Common-Aliases"></a>
<br>
### Common Terminal Aliases
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.
You are free to modify the `aliases.sh` as you see fit, adding your own aliases (or function macros) to suit your requirements.
<br>
<a name="Install-Aerospike-Extension"></a>

View File

@ -82,6 +82,17 @@ USER root
COPY ./crontab /etc/cron.d
RUN chmod -R 644 /etc/cron.d
#####################################
# User Aliases
#####################################
USER root
COPY ./aliases.sh /home/laradock/aliases.sh
RUN echo "" >> ~/.bashrc
RUN echo "# Load Custom Aliases" >> ~/.bashrc
RUN echo "source /home/laradock/aliases.sh" >> ~/.bashrc
RUN echo "" >> ~/.bashrc
#####################################
# xDebug:
#####################################

71
workspace/aliases.sh Normal file
View File

@ -0,0 +1,71 @@
#! /bin/sh
# Colors used for status updates
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
# Commonly Used Aliases
alias ..="cd .."
alias c="clear"
alias cla="clear && ls -l"
alias cll="clear && ls -la"
alias cls="clear && ls"
alias code="cd /var/www"
alias ea="vi ~/aliases"
alias g="gulp"
alias home="cd ~"
alias npm-global="npm list -g --depth 0"
alias ra="reload"
alias reload="source ~/.aliases && echo \"$COL_GREEN ==> Aliases Reloaded... $COL_RESET \n \""
alias run="npm run"
alias tree="xtree"
# Laravel / PHP Alisases
alias art="php artisan"
alias artisan="php artisan"
alias cdump="composer dump-autoload -o"
alias composer:dump="composer dump-autoload -o"
alias db:reset="php artisan migrate:reset && php artisan migrate --seed"
alias migrate="php artisan migrate"
alias seed="php artisan:seed"
alias phpunit="./vendor/bin/phpunit"
# requires installation of 'https://www.npmjs.com/package/npms-cli'
alias npms="npms search"
# requires installation of 'https://www.npmjs.com/package/package-menu-cli'
alias pm="package-menu"
# requires installation of 'https://www.npmjs.com/package/pkg-version-cli'
alias pv="package-version"
# requires installation of 'https://github.com/sindresorhus/latest-version-cli'
alias lv="latest-version"
# git aliases
alias gaa="git add ."
alias gd="git --no-pager diff"
alias git-revert="git reset --hard && git clean -df"
alias gs="git status"
alias whoops="git reset --hard && git clean -df"
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$@"
}
function md() {
mkdir -p "$@" && cd "$@"
}
function xtree {
find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}