⚡ 🐛 better fzf/compose jaaENV
- `§ck-grep`: find combination for symbol - `fzf`: typo - `jaaENV`: switch java support and enhancements
This commit is contained in:
parent
f02723bdc6
commit
ee94361f1a
@ -89,6 +89,7 @@ alias §psmem='§psmem_all | head -n 10'
|
|||||||
alias §pscpu_all='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu'
|
alias §pscpu_all='ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu'
|
||||||
alias §pscpu='§pscpu_all | head -n 10'
|
alias §pscpu='§pscpu_all | head -n 10'
|
||||||
alias §psnet_all='lsof -P -i -n'
|
alias §psnet_all='lsof -P -i -n'
|
||||||
|
alias §ck-grep='cat /usr/share/X11/locale/en_US.UTF-8/Compose ~/.XCompose | grep -i'
|
||||||
|
|
||||||
§ping-test(){ # Pings ip address of noip.com and www.google.com.
|
§ping-test(){ # Pings ip address of noip.com and www.google.com.
|
||||||
ping -c 1 -q 8.23.224.107 | grep --color=never -A 1 -i '\---'
|
ping -c 1 -q 8.23.224.107 | grep --color=never -A 1 -i '\---'
|
||||||
@ -116,7 +117,8 @@ alias npx-wca='npx -y web-component-analyzer'
|
|||||||
alias npx-qnm='npx -y qnm'
|
alias npx-qnm='npx -y qnm'
|
||||||
alias npx-hint='npx -y hint'
|
alias npx-hint='npx -y hint'
|
||||||
alias npx-markdown='nohup npx markserv'
|
alias npx-markdown='nohup npx markserv'
|
||||||
alias zfz=fzf-carroarmato0.fzf
|
|
||||||
|
alias fzf=fzf-carroarmato0.fzf
|
||||||
|
|
||||||
§url-curl(){ curl --silent -I "$1" | grep -i location; }
|
§url-curl(){ curl --silent -I "$1" | grep -i location; }
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ alias C--uu='eval "$($HOME/bin/uu --completion-bash)"'
|
|||||||
alias C--bs='eval "$(bs .completion bash)"'
|
alias C--bs='eval "$(bs .completion bash)"'
|
||||||
alias C--jc='eval "$(jc -B)" … newer version needed'
|
alias C--jc='eval "$(jc -B)" … newer version needed'
|
||||||
\. "$BASH_DOTFILES/cordova.completion"
|
\. "$BASH_DOTFILES/cordova.completion"
|
||||||
|
\. "$BASH_DOTFILES/install-release.completion"
|
||||||
eval "$(node --completion-bash)"
|
eval "$(node --completion-bash)"
|
||||||
eval "$(npm completion)"
|
eval "$(npm completion)"
|
||||||
eval "$(nodejsscript --completion bash)"
|
eval "$(nodejsscript --completion bash)"
|
||||||
|
@ -38,17 +38,21 @@ function jaaENV {
|
|||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
nodejs|node)
|
nodejs|node)
|
||||||
local nodejs_version=`node --version`
|
local nodejs_version=$(node --version)
|
||||||
echo "nodejs=${nodejs_version:1}" >> .jaaENV
|
echo "nodejs=${nodejs_version:1}" >> .jaaENV
|
||||||
;;
|
;;
|
||||||
gradle)
|
gradle)
|
||||||
local gradle_version=`gradle --version | head -n 3 | tail -n 1 | §awk 2`
|
local gradle_version=$(gradle --version | head -n 3 | tail -n 1 | §awk 2)
|
||||||
echo "gradle=$gradle_version" >> .jaaENV
|
echo "gradle=$gradle_version" >> .jaaENV
|
||||||
;;
|
;;
|
||||||
php)
|
php)
|
||||||
local php_version=`php --version | head -n 1 | §awk 2`
|
local php_version=$(php --version | head -n 1 | §awk 2)
|
||||||
echo "php=$php_version" >> .jaaENV
|
echo "php=$php_version" >> .jaaENV
|
||||||
;;
|
;;
|
||||||
|
java)
|
||||||
|
local java_version=$(java -version 2>&1 | head -n 1 | cut -d'"' -f2 | cut -d'.' -f1)
|
||||||
|
echo "java=$java_version" >> .jaaENV
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "unknown '$1' – skipped"
|
echo "unknown '$1' – skipped"
|
||||||
;;
|
;;
|
||||||
@ -73,6 +77,22 @@ function jaaENV {
|
|||||||
else
|
else
|
||||||
. ./.jaaENV
|
. ./.jaaENV
|
||||||
fi
|
fi
|
||||||
|
if [ ! -z ${java+x} ]; then
|
||||||
|
[[ "$java" == "8" ]] && java=1.8
|
||||||
|
local java_local=$(java -version 2>&1 | head -n 1 | cut -d'"' -f2)
|
||||||
|
if [[ "$java_local" != "$java"* ]]; then
|
||||||
|
[[ "$java" == "1.8" ]] && java=8
|
||||||
|
echo "java $java ← $java_local"
|
||||||
|
local v="/usr/lib/jvm/java-$java-openjdk-amd64/"
|
||||||
|
[[ "$java" == "8" ]] && local vv="jre/" || local vv=""
|
||||||
|
sudo update-alternatives --set java ${v}${vv}bin/java
|
||||||
|
local javac=$(update-alternatives --list javac | grep java-$java)
|
||||||
|
[ $javac ] && sudo update-alternatives --set javac $javac
|
||||||
|
sudo -k
|
||||||
|
fi
|
||||||
|
export JAVA_HOME=$(update-alternatives --display java | grep momentálně | §awk 5 | cut -d \/ -f1-5)/
|
||||||
|
echo \$JAVA_HOME=$JAVA_HOME
|
||||||
|
fi
|
||||||
if [ ! -z ${android_home+x} ]; then export ANDROID_HOME=$ANDROID_HOME_BAK; echo "\$ANDROID_HOME=$ANDROID_HOME"; else unset ANDROID_HOME; echo "\$ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"; fi
|
if [ ! -z ${android_home+x} ]; then export ANDROID_HOME=$ANDROID_HOME_BAK; echo "\$ANDROID_HOME=$ANDROID_HOME"; else unset ANDROID_HOME; echo "\$ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"; fi
|
||||||
if [ ! -z ${android_home_is_sdk+x} ]; then export ANDROID_HOME=$ANDROID_SDK_ROOT; echo "\$ANDROID_HOME=$ANDROID_HOME"; fi
|
if [ ! -z ${android_home_is_sdk+x} ]; then export ANDROID_HOME=$ANDROID_SDK_ROOT; echo "\$ANDROID_HOME=$ANDROID_HOME"; fi
|
||||||
if [ ! -z ${jdk+x} ]; then
|
if [ ! -z ${jdk+x} ]; then
|
||||||
@ -87,7 +107,7 @@ function jaaENV {
|
|||||||
if [ ! -z ${nodejs+x} ]; then nvm use $nodejs; fi
|
if [ ! -z ${nodejs+x} ]; then nvm use $nodejs; fi
|
||||||
if [ ! -z ${gradle+x} ]; then sdk use gradle $gradle | tr -d '\n'; echo ; fi
|
if [ ! -z ${gradle+x} ]; then sdk use gradle $gradle | tr -d '\n'; echo ; fi
|
||||||
if [ ! -z ${php+x} ]; then
|
if [ ! -z ${php+x} ]; then
|
||||||
local php_local=`php --version | head -n 1 | §awk 2`
|
local php_local=$(php --version | head -n 1 | §awk 2)
|
||||||
if [[ "$php_local" == "$php"* ]]; then
|
if [[ "$php_local" == "$php"* ]]; then
|
||||||
echo "php $php"
|
echo "php $php"
|
||||||
else
|
else
|
||||||
@ -100,4 +120,5 @@ function jaaENV {
|
|||||||
unset nodejs
|
unset nodejs
|
||||||
unset gradle
|
unset gradle
|
||||||
unset php
|
unset php
|
||||||
|
unset java
|
||||||
}
|
}
|
||||||
|
10
.bash/install-release.completion
Normal file
10
.bash/install-release.completion
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
_install_release_completion() {
|
||||||
|
local IFS=$'
|
||||||
|
'
|
||||||
|
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
|
||||||
|
COMP_CWORD=$COMP_CWORD \
|
||||||
|
_INSTALL_RELEASE_COMPLETE=complete_bash $1 ) )
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -o default -F _install_release_completion install-release
|
Loading…
Reference in New Issue
Block a user