aliases: General cleanup

This commit is contained in:
Robin-Charles Guihéneuf 2020-10-23 09:32:47 +02:00
parent 006f44b2cc
commit 91e51f8d4b

View File

@ -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 <rguiheneuf@netatmo.com>\"' $1"
alias amend_perso="GIT_EDITOR=true git rebase --preserve-merges --exec 'git commit --amend --author=\"Robin-Charles Guihéneuf <robin-charles@hotmail.fr>\"' $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