Browse Source

kwh-calc renamed to more suitable name kwh-cost.

master
Alexander Andreev 8 months ago
parent
commit
e61890310f
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F
  1. 2
      .gitignore
  2. 6
      Makefile
  3. 6
      PKGBUILD
  4. 10
      README.md
  5. 6
      src/main.c

2
.gitignore vendored

@ -1,3 +1,3 @@
*.o
kwh-calc
kwh-cost
.vscode

6
Makefile

@ -1,4 +1,4 @@
TARGET=kwh-calc
TARGET=kwh-cost
CFLAGS=--std=c2x -O3 -Wall -Werror -Wextra -pedantic
@ -22,8 +22,8 @@ clean:
install:
install -Dm755 ${TARGET} ${DESTDIR}usr/bin/${TARGET}
install -Dm644 LICENSE ${DESTDIR}usr/share/licenses/kwh-calc/LICENSE
install -Dm644 LICENSE ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE
uninstall:
rm -f ${DESTDIR}usr/bin/${TARGET}
rm -f ${DESTDIR}usr/share/licenses/kwh-calc/LICENSE
rm -f ${DESTDIR}usr/share/licenses/${TARGET}/LICENSE

6
PKGBUILD

@ -1,13 +1,13 @@
# Maintainer: Alexander "Arav" Andreev <me@arav.top>
pkgname=kwh-calc
pkgname=kwh-cost
pkgver=1.0.0
pkgrel=1
epoch=0
pkgdesc="Calculate cost of electricity."
arch=('any')
url="https://git.arav.top/Arav/kwh-calc"
url="https://git.arav.top/Arav/kwh-cost"
license=('MIT')
source=('git+https://git.arav.top/Arav/kwh-calc.git')
source=('git+https://git.arav.top/Arav/kwh-cost.git')
md5sums=('SKIP')
build() {

10
README.md

@ -1,11 +1,11 @@
# kwh-calc
# kwh-cost
Calculate cost of electricity.
## How to use
```shell
$ kwh-calc [OPTIONS] price wattage interval [interval ..]
$ kwh-cost [OPTIONS] price wattage interval [interval ..]
```
Options are -v, --version to show program's version; and -h, --help to show usage of a program.
@ -18,7 +18,7 @@ Options are -v, --version to show program's version; and -h, --help to show usag
Here is an example:
```shell
$ kwh-calc 3.68 120 30d 2h
$ kwh-cost 3.68 120 30d 2h
```
P.S.: Yeah, I pay 3.68 rubles per kWh. Which is just $0.05. :)
@ -27,8 +27,8 @@ P.S.: Yeah, I pay 3.68 rubles per kWh. Which is just $0.05. :)
### Manually
First run `make` to build a program, and then `make install` to copy executable in `/usr/bin/`. Later, use `make uninstall` to delete it, or just delete `/usr/bin/kwh-calc`.
First run `make` to build a program, and then `make install` to copy executable in `/usr/bin/`. Later, use `make uninstall` to delete it, or just delete `/usr/bin/kwh-cost`.
### For ArchLinux
You can take a [PKGBUILD](/Arav/kwh-calc/raw/branch/master/PKGBUILD) file and in a directory with it run `makepkg -i`.
You can take a [PKGBUILD](/Arav/kwh-cost/raw/branch/master/PKGBUILD) file and in a directory with it run `makepkg -i`.

6
src/main.c

@ -75,13 +75,13 @@ inline price_t to_wattpersecond(price_t price) {
}
void print_version() {
puts("kwh-calc Ver. " VERSION "\n"
puts("kwh-cost Ver. " VERSION "\n"
"Copyright (C) 2021 Alexander \"Arav\" Andreev <me@arav.top>. All rights reserved.\n"
"License for this program is stored in /usr/share/licenses/kwh-calc/LICENSE.");
"License for this program is stored in /usr/share/licenses/kwh-cost/LICENSE.");
}
void print_usage() {
puts("Usage: kwh-calc [options] price wattage interval [interval ...]\n"
puts("Usage: kwh-cost [options] price wattage interval [interval ...]\n"
"Options:\n"
" --help, -h Display this usage information.\n"
" --version, -v Display program version.\n"

Loading…
Cancel
Save