Well as it turns out, its actually very easy to do. The tool that we will use to check the battery percentage is called "ioreg". The Mac OS X manual describes ioreg as a tool that "displays the I/O Kit registry. It shows the hierarchical registry structure as an inverted tree."
There are many options available with the ioreg tool, however this article will just be discussing how to check the battery percentage of different devices. See the below text for the code to view the battery percentage:
matthewturner/~: ioreg -n "IOAppleBluetoothHIDDriver" | grep -i "batterypercent" | sed 's/[^[:digit:]]//g'
49
matthewturner/~: ioreg -n "BNBMouseDevice" | grep -i "batterypercent" | sed 's/[^[:digit:]]//g'
45
matthewturner/~: ioreg -n "BNBMouseDevice" | grep -i "batterypercent"
| | | | | | | "BatteryPercent" = 45
There are a few things that should be noted about the above commands.