From 7a5c3a66e2b27994bbbe953005a15f08c27e5a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin-Charles=20Guih=C3=A9neuf?= Date: Fri, 23 Oct 2020 09:32:47 +0200 Subject: [PATCH] aliases: General cleanup --- .bash_aliases | 97 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 30 deletions(-) diff --git a/.bash_aliases b/.bash_aliases index d33324d..7d221f1 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -1,19 +1,29 @@ export CONFIG_DIR="$HOME/.dotfiles" -# Refresh +# ╦═╗┌─┐┌─┐┬─┐┌─┐┌─┐┬ ┬ +# ╠╦╝├┤ ├┤ ├┬┘├┤ └─┐├─┤ +# ╩╚═└─┘└ ┴└─└─┘└─┘┴ ┴ + if [ -z "${ZSH}" ]; then alias refresh=". $HOME/.bashrc" else alias refresh=". $HOME/.zshrc" fi -# Nautilus -alias open="nautilus ." +# ╦┌┐┌┌─┐┌┬┐┌─┐┬ ┬ +# ║│││└─┐ │ ├─┤│ │ +# ╩┘└┘└─┘ ┴ ┴ ┴┴─┘┴─┘ -# Install scripts alias install_cli="$CONFIG_DIR/auto-config-cli.sh" alias install_gui="$CONFIG_DIR/auto-config.sh" +# ╔╦╗╦╔═╗╔═╗ +# ║║║║╚═╗║ +# ╩ ╩╩╚═╝╚═╝ + +# Nautilus +alias open="nautilus ." + # Go to config directory alias config="cd $CONFIG_DIR" @@ -52,33 +62,43 @@ function s_clean { s_on } +# Make +alias mk='make -j5' +alias mec='make' +alias mecque='make' + # VPN alias vpn="sudo openvpn --config $HOME/Nextcloud/#\ -\ Configs/rguiheneuf.ovpn" -# Git -alias gst='git status' +# ╔═╗┬┌┬┐ ╔═╗┬ ┬┌─┐┌─┐┌─┐┌─┐ +# ║ ╦│ │ ╠═╣│ │├─┤└─┐├┤ └─┐ +# ╚═╝┴ ┴ ╩ ╩┴─┘┴┴ ┴└─┘└─┘└─┘ + +alias gs='git status' alias gc='git checkout' alias gcm='git checkout master' alias gpl='git pull' alias gph='git push' -alias pull='git pull' -alias push='git push' alias gsu='git submodule update --init' +alias gcp='git cherry-pick' alias add='git add' alias commit='git commit -m "To fixup"' alias cont='git rebase --continue' +# Git cleaners alias branch_clean='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d' +alias tag_clean='git tag -l | xargs git tag -d && git fetch -t' +alias log='git log --graph --decorate --oneline' + +# Branch function branch_create { git checkout -b $1 git push -u origin $1 } -# Tag -alias tag_clean='git tag -l | xargs git tag -d && git fetch -t' - +# Tag helpers function tag_create { git tag $1 git push origin $1 @@ -91,18 +111,22 @@ function tag_replace { git push origin $1 } -function grb { - git rebase -i HEAD~$1 -} - function g_save { git add * git commit -m "[skip ci] Save: do not merge" git push -f } +# ╔═╗┬┌┬┐ ╦═╗┌─┐┌┐ ┌─┐┌─┐┌─┐ +# ║ ╦│ │ ╠╦╝├┤ ├┴┐├─┤└─┐├┤ +# ╚═╝┴ ┴ ╩╚═└─┘└─┘┴ ┴└─┘└─┘ + +function grb { + git rebase --interactive HEAD~$1 +} + function grbm { - # Save actual branch + # Save current branch BRANCH=$(git branch | grep \* | cut -d ' ' -f2) # Checkout master & pull @@ -111,7 +135,7 @@ function grbm { # Back to previous branch git checkout ${BRANCH} - git rebase -i master + git rebase --interactive master } function grbr { @@ -128,11 +152,17 @@ function ga { git rebase --interactive --autosquash HEAD~$1 } -# Git amend +# ╔═╗┬┌┬┐ ╔═╗┌┬┐┌─┐┌┐┌┌┬┐ +# ║ ╦│ │ ╠═╣│││├┤ │││ ││ +# ╚═╝┴ ┴ ╩ ╩┴ ┴└─┘┘└┘─┴┘ + alias amend_pro="GIT_EDITOR=true git rebase --preserve-merges --exec 'git commit --amend --author=\"Robin-Charles GUIHENEUF \"' $1" alias amend_perso="GIT_EDITOR=true git rebase --preserve-merges --exec 'git commit --amend --author=\"Robin-Charles Guihéneuf \"' $1" -# Repositories +# ╦═╗┌─┐┌─┐┌─┐┌─┐┬┌┬┐┌─┐┬─┐┬┌─┐┌─┐ +# ╠╦╝├┤ ├─┘│ │└─┐│ │ │ │├┬┘│├┤ └─┐ +# ╩╚═└─┘┴ └─┘└─┘┴ ┴ └─┘┴└─┴└─┘└─┘ + alias bc='cd $HOME/Netatmo/embedded/firmware-bitcloud' alias fw='cd $HOME/Netatmo/embedded/firmware' alias nmr='cd $HOME/Netatmo/embedded/nmr' @@ -141,7 +171,7 @@ alias mag='cd $HOME/Netatmo/embedded/magellan' alias nsp='cd $HOME/Netatmo/embedded/nsp' alias mulot='cd $HOME/mulot/firmware' -# Repositories in editor +# In editor alias c_bc='c $HOME/Netatmo/firmware-bitcloud.code-workspace' alias c_fw='c $HOME/Netatmo/firmware.code-workspace' alias c_nmr='c $HOME/Netatmo/nmr.code-workspace' @@ -158,6 +188,10 @@ function ssh_keygen { cd - } +# ╔╗╔┌─┐┌┬┐┌─┐┌┬┐┌┬┐┌─┐ +# ║║║├┤ │ ├─┤ │ ││││ │ +# ╝╚╝└─┘ ┴ ┴ ┴ ┴ ┴ ┴└─┘ + # Flash sniffer nRF52 function nrf52 { arm-none-eabi-objcopy -O ihex output/nrf52840/bin/$1 $1.hex @@ -171,11 +205,6 @@ function nrf52 { fi } -# Make -alias mk='make -j5' -alias mec='make' -alias mecque='make' - # app.S function generate_objdump { arm-none-eabi-objdump -S $1.elf > app.S @@ -192,6 +221,10 @@ alias py_wireshark='$HOME/Netatmo/core/python-emb-tools/python/bin/zigbee/python alias stflash='sudo stm32_sbm -f app.bin -s 0x1000 -d' alias stflash_dfu='stm32_dfu -f app-jtag.bin -b' +# ╔═╗┬┌┬┐ ╔═╗┬─┐┌─┐┌┬┐┌─┐┌┬┐ +# ║ ╦│ │ ╠═╝├┬┘│ ││││├─┘ │ +# ╚═╝┴ ┴ ╩ ┴└─└─┘┴ ┴┴ ┴ + # Git prompt if [ -z "${ZSH}" ]; then if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then @@ -204,11 +237,9 @@ else fi fi -# Autofixup -export PATH=$PATH:$HOME/.git-autofixup - -# Netatmo -export NETATMO_WORK_DIR=$HOME/Netatmo +# ╔═╗─┐ ┬┌─┐┌─┐┬─┐┌┬┐ +# ║╣ ┌┴┬┘├─┘│ │├┬┘ │ +# ╚═╝┴ └─┴ └─┘┴└─ ┴ export PATH=$PATH:~/Netatmo/core/embedded-tools/Linux/flasher export PATH=$PATH:~/Netatmo/core/generic-embedded/stm32_sbm @@ -216,6 +247,12 @@ export PATH=$PATH:~/Netatmo/core/generic-embedded/stm32_dfu export PATH=$PATH:~/Netatmo/embedded/firmware-bitcloud/toolchain/arm-none-eabi/bin export PATH=$PATH:~/Netatmo/embedded/nmr/scripts/flash +# Autofixup +export PATH=$PATH:$HOME/.git-autofixup + +# Netatmo +export NETATMO_WORK_DIR=$HOME/Netatmo + # Cargo binaries (navi) export PATH=$PATH:$HOME/.cargo/bin