1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-18 05:40:07 +00:00

Merge pull request #191 from rjorgenson/next

added check for nvm command before running
This commit is contained in:
Ben Hilburn 2016-01-15 18:53:42 -08:00
commit 817cdf98a1

View file

@ -312,7 +312,7 @@ prompt_battery() {
if [[ $OS =~ OSX && -f /usr/sbin/ioreg && -x /usr/sbin/ioreg ]]; then if [[ $OS =~ OSX && -f /usr/sbin/ioreg && -x /usr/sbin/ioreg ]]; then
# Pre-Grep as much information as possible to save some memory and # Pre-Grep as much information as possible to save some memory and
# avoid pollution of the xtrace output. # avoid pollution of the xtrace output.
local raw_data=$(ioreg -n AppleSmartBattery | grep -E "MaxCapacity|TimeRemaining|CurrentCapacity|ExternalConnected|IsCharging") local raw_data="$(ioreg -n AppleSmartBattery | grep -E "MaxCapacity|TimeRemaining|CurrentCapacity|ExternalConnected|IsCharging")"
# return if there is no battery on system # return if there is no battery on system
[[ -z $(echo $raw_data | grep MaxCapacity) ]] && return [[ -z $(echo $raw_data | grep MaxCapacity) ]] && return
@ -533,6 +533,7 @@ prompt_node_version() {
# Node version from NVM # Node version from NVM
# Only prints the segment if different than the default value # Only prints the segment if different than the default value
prompt_nvm() { prompt_nvm() {
[[ ! $(type nvm) =~ 'nvm is a shell function'* ]] && return
local node_version=$(nvm current) local node_version=$(nvm current)
local nvm_default=$(cat $NVM_DIR/alias/default) local nvm_default=$(cat $NVM_DIR/alias/default)
[[ -z "${node_version}" ]] && return [[ -z "${node_version}" ]] && return