From e35cf075bff189a67ac62851cad9b2d6e35a2581 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Sat, 12 Jul 2025 17:59:06 +0200 Subject: [PATCH] Extract JavaScript aliases to '~/.bash_aliases/js' --- .bash_aliases/all | 32 -------------------------------- .bash_aliases/lang-js | 35 +++++++++++++++++++++++++++++++++++ .bashrc | 1 + 3 files changed, 36 insertions(+), 32 deletions(-) create mode 100644 .bash_aliases/lang-js diff --git a/.bash_aliases/all b/.bash_aliases/all index 3e6588b..ddb7ec0 100644 --- a/.bash_aliases/all +++ b/.bash_aliases/all @@ -63,8 +63,6 @@ alias xev='xev | grep -A2 ButtonPress' # Ignore mouse movements alias mm='micromamba' # Languages -alias js="node" -alias ts="ts-node" alias r5="plt-r5rs --no-prim" alias hs="ghci" alias pl="swipl" @@ -74,33 +72,3 @@ alias r="R" alias azerty="setxkbmap be" alias qwerty="setxkbmap us" alias cole="setxkbmap us -variant colemak" - -yarn() { - if [[ -f "package-lock.json" ]]; then - echo "WARNING: package-lock.json exists" - read -p "Are you sure you want to run yarn? [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - command yarn "$@" - else - echo "Aborted" - fi - else - command yarn "$@" - fi -} - -npm() { - if [[ -f "yarn.lock" ]]; then - echo "WARNING: yarn.lock exists" - read -p "Are you sure you want to run npm? [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - command npm "$@" - else - echo "Aborted" - fi - else - command npm "$@" - fi -} diff --git a/.bash_aliases/lang-js b/.bash_aliases/lang-js new file mode 100644 index 0000000..cf4117f --- /dev/null +++ b/.bash_aliases/lang-js @@ -0,0 +1,35 @@ +# shellcheck shell=bash +# vim: set ft=bash : + +alias js="node" +alias ts="ts-node" + +yarn() { + if [[ -f "package-lock.json" ]]; then + echo "WARNING: package-lock.json exists" + read -p "Are you sure you want to run yarn? [y/N] " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + command yarn "$@" + else + echo "Aborted" + fi + else + command yarn "$@" + fi +} + +npm() { + if [[ -f "yarn.lock" ]]; then + echo "WARNING: yarn.lock exists" + read -p "Are you sure you want to run npm? [y/N] " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + command npm "$@" + else + echo "Aborted" + fi + else + command npm "$@" + fi +} diff --git a/.bashrc b/.bashrc index 3ed90aa..94a32dd 100644 --- a/.bashrc +++ b/.bashrc @@ -14,6 +14,7 @@ [ -f "$HOME/.bash_aliases/all" ] && . "$HOME/.bash_aliases/all" [ -f "$HOME/.bash_aliases/hosts/$HOSTNAME" ] && . "$HOME/.bash_aliases/hosts/$HOSTNAME" [ -f "$HOME/.bash_aliases/private" ] && . "$HOME/.bash_aliases/private" +[ -f "$HOME/.bash_aliases/lang-js" ] && . "$HOME/.bash_aliases/lang-js" command -v jira >/dev/null && [ -f "$HOME/.bash_aliases/jira" ] && . "$HOME/.bash_aliases/jira" # Completions {{{