Based on distatus/battery.
$ go get -u github.com/LEI/battery
$ cd $GOPATH/src/github.com/LEI/battery
$ dep ensure -vendor-only
$ go install github.com/LEI/battery
$ battery -h
battery [flags] [format]
-c, --color Enable color output
-s, --spark Enable sparkline bar
-t, --tmux Enable tmux status bar colors
Default format:
$ battery '{{.Id}}: {{.State}}, {{.Percent}}%{{if ne .Duration ""}}, {{end}}{{.Duration}}'
BAT0: Full, 100%
Example:
$ battery --spark '{{.Bar}}'
█ 100%