#!/bin/sh
#
# pmset-battery-percent:
# show the internal battery percent charged.
#
# Syntax:
#
#     pmset-battery-percent
#
# Example:
#
#     $ pmset-battery-percent
#     100
#
# These commands are all related:
#
#   * `pmset-battery-full`
#   * `pmset-battery-percent`
#   * `pmset-drawing`
#   * `pmset-drawing-ac-power`
#   * `pmset-drawing-battery-power`
#   * `pmset-powerful`
#
# ## Tracking
#
#   * Command: pmset-battery-percent
#   * Version: 2.0.1
#   * Created: 2015-07-01
#   * Updated: 2017-11-02
#   * License: GPL
#   * Contact: Joel Parker Henderson (joel@joelparkerhenderson.com)
##
set -euf
pmset -g batt | sed -n 's/.*InternalBattery-0 .*[^[:digit:]]\([[:digit:]]\+\)%.*/\1/p'
