edkolev / promptline.vim

Generate a fast shell prompt with powerline symbols and airline colors
MIT License
625 stars 54 forks source link

Fix an issue with globbing for BAT* when it is not present. On Ubuntu 14... #22

Open ziegs opened 10 years ago

ziegs commented 10 years ago

Fix an issue with globbing for BAT* when it is not present. On Ubuntu 14.04, machines without a battery don't have any BAT* devices, and zsh throws an error instead of passing an empty glob. http://zshwiki.org/home/options/expn has documentation for the null_glob option.

Prior to this change, machines without a battery print

__promptline_battery:27: no matches found: /sys/class/power_supply/BAT*

before each prompt.

edkolev commented 10 years ago

Thanks for catching this!

I don't think that bash supports setopt localoptions. Do you think there's another solution, without using nullglob?

JTarasovic commented 8 years ago

I just used a quick find like so...

[ "$(find /sys/class/power_supply/ -maxdepth 0 -type d -empty 2>/dev/null)" ] && return 1