No description
Find a file
Prasanna Venkadesh 2ce7b89d35 Merge branch 'hotfix/0.2.1' into 'main'
Fix Issue #1 - Incorrect battery charge

See merge request prashere/battinfo!2
2023-08-21 16:57:20 +00:00
build Bump version and add changelog 2023-08-21 22:23:13 +05:30
src Fix Issue #1 - Incorrect battery charge 2023-08-21 22:13:44 +05:30
.gitignore Add .gitignore file 2023-07-31 19:13:17 +05:30
.gitlab-ci.yml Fix .gitlab-ci.yml 2023-08-01 10:17:27 +05:30
battinfo.nimble Bump version and add changelog 2023-08-21 22:23:13 +05:30
LICENSE Add LICENSE 2023-07-18 13:13:27 +00:00
Makefile Change Debian control directory permission 2023-08-01 10:23:50 +05:30
README.md Update README.md 2023-08-11 21:05:07 +05:30

battinfo

nimble

Introduction

A simple command line utility and a nim library to discover batteries in your GNU/Linux machine and print it's information in the console.

Get Started

Install using nimble package manager

  $ nimble install battinfo

Note: One can also install without nimble directly by downloading either the 64-bit executable binary or .deb package for Debian/Ubuntu based distros from the releases

Using as cli tool

  # discovers batteries and displays their info
  $ battinfo

Using battinfo as library in your Nim program

import battinfopkg/battery

var batteries: seq = get_batteries()  # returns a sequence of battery files found in the system.
echo batteries

if batteries.len > 0:
  # following procedures accept battery file path as argument
  echo get_status(batteries[0])          # returns charging/discharging status as string
  echo get_manufacturer(batteries[0])    # returns the name of the manufacturer as string
  echo get_model(batteries[0])           # returns the battery model as string
  echo get_tech(batteries[0])            # returns the type of battery as string
  echo get_serial(batteries[0])          # returns serial info of the battery as string
  echo get_percentage(batteries[0])      # returns battery percentage left as int
  echo get_current_charge(batteries[0])  # returns the current charge as float
  echo get_total_capacity(batteries[0])  # returns the total capacity of the battery as float

License

This software is offered as a Free Software under the terms of GNU General Public License version 3.