mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-12 15:34:50 +08:00
Compare commits
3 Commits
0e57142729
...
d959283898
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d959283898 | ||
|
|
b72607bc8e | ||
|
|
7290a08bf6 |
@ -21,7 +21,8 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
||||
local smart_battery_status="$(ioreg -rc AppleSmartBattery)"
|
||||
local -F maxcapacity=$(command grep '^.*"MaxCapacity"\ =\ ' <<< $smart_battery_status | sed -e 's/^.*"MaxCapacity"\ =\ //')
|
||||
local -F currentcapacity=$(command grep '^.*"CurrentCapacity"\ =\ ' <<< $smart_battery_status | sed -e 's/^.*CurrentCapacity"\ =\ //')
|
||||
echo $(( (currentcapacity/maxcapacity) * 100 ))
|
||||
local -i pct=$(( (currentcapacity/maxcapacity) * 100 ))
|
||||
echo $pct
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
@ -47,16 +48,17 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
||||
}
|
||||
|
||||
function battery_pct_prompt () {
|
||||
local battery_pct color
|
||||
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then
|
||||
b=$(battery_pct_remaining)
|
||||
if [[ $b -gt 50 ]]; then
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $b -gt 20 ]]; then
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
||||
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
|
||||
else
|
||||
echo "∞"
|
||||
fi
|
||||
@ -93,19 +95,19 @@ elif [[ "$OSTYPE" = freebsd* ]]; then
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
local b color
|
||||
b=$(battery_pct_remaining)
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if battery_is_charging; then
|
||||
echo "∞"
|
||||
else
|
||||
if [[ $b -gt 50 ]]; then
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $b -gt 20 ]]; then
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -136,19 +138,19 @@ elif [[ "$OSTYPE" = linux* ]]; then
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
local b color
|
||||
b=$(battery_pct_remaining)
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if battery_is_charging; then
|
||||
echo "∞"
|
||||
else
|
||||
if [[ $b -gt 50 ]]; then
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $b -gt 20 ]]; then
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}$(battery_pct_remaining)%%%{$reset_color%}"
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
11
plugins/jfrog/README.md
Normal file
11
plugins/jfrog/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# JFrog CLI
|
||||
|
||||
This plugin provides completion for [JFrog CLI](https://github.com/jfrog/jfrog-cli).
|
||||
|
||||
JFrog CLI provides a simple interface that automates access to [Artifactory](https://jfrog.com/artifactory), [Xray](https://jfrog.com/xray), [Bintray](https://jfrog.com/bintray) and [Mission Control](https://jfrog.com/mission-control) through their respective REST APIs.
|
||||
|
||||
To use it, add `jfrog` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... jfrog)
|
||||
```
|
||||
10
plugins/jfrog/jfrog.plugin.zsh
Normal file
10
plugins/jfrog/jfrog.plugin.zsh
Normal file
@ -0,0 +1,10 @@
|
||||
_jfrog() {
|
||||
local -a opts
|
||||
opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
|
||||
_describe 'values' opts
|
||||
if [[ $compstate[nmatches] -eq 0 && $words[$CURRENT] != -* ]]; then
|
||||
_files
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _jfrog jfrog
|
||||
@ -7,9 +7,9 @@ typeset +H _hist_no="%{$fg[grey]%}%h%{$reset_color%}"
|
||||
|
||||
PROMPT='
|
||||
$(_user_host)${_current_dir} $(git_prompt_info) $(ruby_prompt_info)
|
||||
%{%F{%(!.red.white)}%}▶%{$resetcolor%} '
|
||||
%{%(!.%F{red}.%F{white})%}▶%{$resetcolor%} '
|
||||
|
||||
PROMPT2='%{%F{%(!.red.white)}%}◀%{$reset_color%} '
|
||||
PROMPT2='%{%(!.%F{red}.%F{white})%}◀%{$reset_color%} '
|
||||
|
||||
RPROMPT='$(vi_mode_prompt_info)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user