mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
global: Switch the function-declarations to avoid unexpected alias expansions
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
#! bash oh-my-bash.module
|
||||
|
||||
_omb_plugin_battery__upower_print_info() {
|
||||
function _omb_plugin_battery__upower_print_info {
|
||||
upower -i "$(upower -e | sed -n '/BAT/{p;q;}')"
|
||||
}
|
||||
|
||||
ac_adapter_connected(){
|
||||
function ac_adapter_connected {
|
||||
if _omb_util_command_exists upower;
|
||||
then
|
||||
_omb_plugin_battery__upower_print_info | grep -qE 'state[:[:blank:]]*(charging|fully-charged)'
|
||||
@@ -28,7 +28,7 @@ ac_adapter_connected(){
|
||||
fi
|
||||
}
|
||||
|
||||
ac_adapter_disconnected(){
|
||||
function ac_adapter_disconnected {
|
||||
if _omb_util_command_exists upower;
|
||||
then
|
||||
_omb_plugin_battery__upower_print_info | grep -qE 'state[:[:blank:]]*discharging'
|
||||
@@ -55,7 +55,7 @@ ac_adapter_disconnected(){
|
||||
## @fn battery_percentage
|
||||
## @about 'displays battery charge as a percentage of full (100%)'
|
||||
## @group 'battery'
|
||||
battery_percentage(){
|
||||
function battery_percentage {
|
||||
if _omb_util_command_exists upower;
|
||||
then
|
||||
local UPOWER_OUTPUT=$(_omb_plugin_battery__upower_print_info | sed -n 's/.*percentage[:[:blank:]]*\([0-9%]\{1,\}\)$/\1/p')
|
||||
@@ -129,7 +129,7 @@ battery_percentage(){
|
||||
## @fn battery_charge
|
||||
## @about 'graphical display of your battery charge'
|
||||
## @group 'battery'
|
||||
battery_charge(){
|
||||
function battery_charge {
|
||||
# Full char
|
||||
local F_C='▸'
|
||||
# Depleted char
|
||||
|
@@ -3,13 +3,13 @@
|
||||
# Initialize fasd, without setting up the prompt hook, which
|
||||
# we want to be handled by oh-my-bash.
|
||||
|
||||
_omb_plugin_fasd_prompt_func() {
|
||||
function _omb_plugin_fasd_prompt_func {
|
||||
local sink=${OMB_PLUGIN_FASD_SINK:-/dev/null}
|
||||
[[ $sink == /dev/null ]] && return 0
|
||||
fasd --proc "$(fasd --sanitize "$(history 1 | command sed 's/^[ ]*[0-9]*[ ]*//')")" >> "$sink" 2>&1
|
||||
}
|
||||
|
||||
_omb_plugin_fasd_initialize() {
|
||||
function _omb_plugin_fasd_initialize {
|
||||
if _omb_util_command_exists fasd; then
|
||||
eval -- "$(fasd --init posix-alias bash-ccomp bash-ccomp-install)"
|
||||
_omb_util_add_prompt_command _omb_plugin_fasd_prompt_func
|
||||
|
@@ -87,7 +87,7 @@ alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
gdv() {
|
||||
function gdv {
|
||||
git diff -w "$@" | view -
|
||||
}
|
||||
#compdef _git gdv=git-diff
|
||||
@@ -96,7 +96,7 @@ alias gf='git fetch'
|
||||
alias gfa='git fetch --all --prune'
|
||||
alias gfo='git fetch origin'
|
||||
|
||||
gfg() {
|
||||
function gfg {
|
||||
git ls-files | grep "$@"
|
||||
}
|
||||
#compdef _grep gfg
|
||||
@@ -104,13 +104,13 @@ gfg() {
|
||||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
|
||||
ggf() {
|
||||
function ggf {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force origin "${b:=$1}"
|
||||
}
|
||||
#compdef _git ggf=git-checkout
|
||||
|
||||
ggl() {
|
||||
function ggl {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
@@ -120,7 +120,7 @@ ggl() {
|
||||
}
|
||||
#compdef _git ggl=git-checkout
|
||||
|
||||
ggp() {
|
||||
function ggp {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git push origin "${*}"
|
||||
else
|
||||
@@ -130,7 +130,7 @@ ggp() {
|
||||
}
|
||||
#compdef _git ggp=git-checkout
|
||||
|
||||
ggpnp() {
|
||||
function ggpnp {
|
||||
if [[ "$#" == 0 ]]; then
|
||||
ggl && ggp
|
||||
else
|
||||
@@ -139,7 +139,7 @@ ggpnp() {
|
||||
}
|
||||
#compdef _git ggpnp=git-checkout
|
||||
|
||||
ggu() {
|
||||
function ggu {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git pull --rebase origin "${b:=$1}"
|
||||
}
|
||||
|
@@ -76,7 +76,7 @@ alias kdd='kubectl describe deployment'
|
||||
alias kdeld='kubectl delete deployment'
|
||||
alias ksd='kubectl scale deployment'
|
||||
alias krsd='kubectl rollout status deployment'
|
||||
kres(){
|
||||
function kres {
|
||||
kubectl set env $@ REFRESHED_AT=$(date +%Y%m%d%H%M%S)
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@ fi
|
||||
# SOFTWARE.
|
||||
#
|
||||
if _omb_util_command_exists nvm && [[ ${OMB_PLUGIN_NVM_AUTO_USE-} == true ]]; then
|
||||
_omb_plugin_nvm_find_up() {
|
||||
function _omb_plugin_nvm_find_up {
|
||||
local path=$PWD
|
||||
while [[ $path && ! -e $path/$1 ]]; do
|
||||
path=${path%/*}
|
||||
@@ -53,7 +53,7 @@ if _omb_util_command_exists nvm && [[ ${OMB_PLUGIN_NVM_AUTO_USE-} == true ]]; th
|
||||
echo "$path"
|
||||
}
|
||||
|
||||
_omb_plugin_nvm_cd(){
|
||||
function _omb_plugin_nvm_cd {
|
||||
cd "$@" || return "$?"
|
||||
local nvm_path=$(_omb_plugin_nvm_find_up .nvmrc)
|
||||
|
||||
|
@@ -15,11 +15,11 @@
|
||||
#
|
||||
# [1] https://github.com/ohmybash/oh-my-bash/pull/332
|
||||
|
||||
_osh_plugin_tmux_autoattach_exit() {
|
||||
function _osh_plugin_tmux_autoattach_exit {
|
||||
[ -z "$TMUX" ] && tmux -2u new -As0 && exit
|
||||
}
|
||||
|
||||
_osh_plugin_tmux_autoattach_detach() {
|
||||
function _osh_plugin_tmux_autoattach_detach {
|
||||
[ -z "$TMUX" ] && tmux -2u new -As0
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user