diff options
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | Makefile | 29 | ||||
| -rw-r--r-- | config.mk | 4 | ||||
| -rw-r--r-- | pfc.1 | 52 |
5 files changed, 78 insertions, 11 deletions
@@ -113,7 +113,7 @@ dependencies = [ [[package]] name = "pfc" -version = "0.3.0" +version = "0.3.1" dependencies = [ "crossterm", "tui", @@ -1,6 +1,6 @@ [package] name = "pfc" -version = "0.3.0" +version = "0.3.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -1,18 +1,29 @@ -build: test format +include config.mk + +build: + cargo fmt --all + cargo test cargo build run: build - ./target/debug/pfc + target/debug/pfc -doc: test format +doc: cargo doc --open -test: format - cargo test - -format: - cargo fmt --all +clean: + rm -r target install: cargo build --release - cp ./target/release/pfc ~/.local/bin/ + cp target/release/pfc ${DESTDIR}${PREFIX}/bin + chmod 755 ${DESTDIR}${PREFIX}/bin/pfc + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + sed "s/VERSION/${VERSION}/g" < pfc.1 > ${DESTDIR}${MANPREFIX}/man1/pfc.1 + chmod 644 ${DESTDIR}${MANPREFIX}/man1/pfc.1 + +uninstall: + rm -f ${DESTDIR}${PREFIX}/bin/pfc\ + ${DESTDIR}${MANPREFIX}/man1/pfc.1 + +.PHONY: build run doc clean install uninstall diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..c545550 --- /dev/null +++ b/config.mk @@ -0,0 +1,4 @@ +VERSION = 0.3 + +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man @@ -0,0 +1,52 @@ +.TH PFC 1 pfc\-VERSION +.SH NAME +pfc \- postfix calculator +.SH SYNOPSIS +.B pfc +.SH DESCRIPTION +pfc is an interactive postfix, or reverse Polish notation, calculator. +.SH USAGE +.SS Keyboard commands +.TP +.B q +Quit. +.TP +.B [0..9] +Enter a digit into the input buffer. +pfc works with floating point numbers so the +.B . +character is OK as well. +.TP +.B Backspace +Remove a digit from the input buffer. +.TP +.B Enter +Push the number in the input buffer to the stack. +.TP +.B j +Swap the bottom (most recently pushed) item on the stack with the input buffer. +If the input buffer is empty this simply moves the most recently pushed item +back into the input buffer. +.TP +.B k +The same as +.BR j . +.TP +.B d +Delete the contents of the input buffer. +.SS Operators +.TP +.B + +Addition. +.TP +.B - +Subtraction. +.TP +.B * +Multiplication. +.TP +.B / +Division. +.TP +.B ^ +Exponentiation. |