2021-04-10 11:51:03 +02:00
|
|
|
#!/usr/bin/bash
|
2021-04-09 10:59:52 +02:00
|
|
|
|
2021-04-10 11:51:03 +02:00
|
|
|
# custom function management here
|
|
|
|
# changes to the worthwhile-functions filepath requires
|
|
|
|
# an update o the filepath via 'edit-script reload-funcs-bashrc
|
|
|
|
# and also any reference here
|
2021-04-09 10:59:52 +02:00
|
|
|
disable-funcs () {
|
2021-04-10 11:51:03 +02:00
|
|
|
echo "info: Unimplemented yet. Tell Andrei to add it to his todo."
|
|
|
|
}
|
|
|
|
edit-funcs-bashrc() {
|
|
|
|
$(echo $EDITOR || command -v nano>>/dev/null && echo nano || echo vi) ~/.dotfiles/bashrc/worthwhile-functions
|
2021-04-09 10:59:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
list-debs-size () {
|
|
|
|
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rn | less
|
|
|
|
}
|
2021-04-10 11:51:03 +02:00
|
|
|
|
|
|
|
edit-script-file () {
|
|
|
|
# if you use other editor, please set $EDITOR.
|
|
|
|
$(echo $EDITOR || command -v nano>>/dev/null && echo nano || echo vi) $(command -v $1)
|
|
|
|
}
|
|
|
|
|
|
|
|
# reloading stuff
|
|
|
|
refresh-funcs() {
|
|
|
|
$DOTFILES_STUFF_BIN/reload-funcs-bashrc
|
|
|
|
}
|
|
|
|
refresh-aliases() {
|
|
|
|
source $HOME/.dotfiles/bashrc/aliases
|
|
|
|
}
|
2021-04-25 10:02:26 +02:00
|
|
|
|
|
|
|
# https://commentedcode.org/blog/2020/09/21/changing-default-branch-of-git-init/
|
|
|
|
function git() {
|
|
|
|
command git "$@"
|
|
|
|
if [[ $? -eq 0 && "$1" == "init" && "$@" != *"--help"* ]]; then
|
|
|
|
echo "Setting HEAD to branch main"
|
|
|
|
git symbolic-ref HEAD refs/heads/main
|
|
|
|
fi
|
|
|
|
}
|
2021-05-17 08:26:49 +02:00
|
|
|
|
|
|
|
list-nodejs-scripts() {
|
|
|
|
cat package.json | jq .scripts || echo "No package.json found in current directory."
|
|
|
|
}
|