From 30d5d877103d7c04a414428184261e1823e3186a Mon Sep 17 00:00:00 2001 From: Blau Araujo Date: Mon, 14 Mar 2022 15:56:18 -0300 Subject: [PATCH] man page and makefile --- Makefile | 15 ++++++++++++++ README.md | 58 +++++++++++++++++++++++++++++++++++++++++++------------ cawk.1 | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 12 deletions(-) create mode 100644 Makefile create mode 100644 cawk.1 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ef40db6 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +PREFIX ?= /usr +MANDIR ?= $(PREFIX)/share/man + +all: + echo Run \'make install\' to install cawk. + +install: + mkdir -p $(DESTDIR)$(PREFIX)/bin + mkdir -p $(DESTDIR)$(MANDIR)/man1 + cp -p cawk $(DESTDIR)$(PREFIX)/bin/cawk + cp -p cawk.1 $(DESTDIR)$(MANDIR)/man1 + +uninstall: + rm -rf $(DESTDIR)$(PREFIX)/bin/cawk + rm -rf $(DESTDIR)$(MANDIR)/man1/cawk.1* diff --git a/README.md b/README.md index cdee11d..27ac0de 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,54 @@ # cawk -REPL calculator in Bash and AWK +REPL calculator in Bash and GNU awk +## Usage + +``` +cawk [-f PRECISION] - Start in REPL mode. +cawk -e EXPRESSION [-f PRECISION] - Eval EXPRESSION and quit. +COMMAND | cawk [-f PRECISION] - Eval expressions from COMMAND output. +cawk [-f PRECISION] < FILE +``` + +### Options + +``` +-e EXPRESSION Expression to evaluate. +-f PRECISION Number of positions after decimal point. +``` + +### Commands (in REPL mode) + +``` + f PRECISION Redefine precision. + h or ? Help. + q or quit Exit. +``` + +## Depends + +- Bash 5+ +- GNU awk + +## Install + +Clone this repository: + +``` +:~$ git clone https://git.blauaraujo.com/blau_araujo/cawk.git ``` -USAGE - cawk [-f PRECISION] - Start in REPL mode. - cawk -e EXPRESSION [-f PRECISION] - Eval EXPRESSION and quit. - COMMAND | cawk [-f PRECISION] - Eval expressions from COMMAND output. -OPTIONS - -e EXPRESSION Expression to evaluate. - -f PRECISION Number of positions after decimal point. +As root, enter `cawk` directory and run: -COMMANDS - f[0-9] Redefine precision. - h|? Help. - q|quit Quit. ``` +make install +``` + +## Uninstall + +As root, enter `cawk` directory and run: +``` +make uninstall +``` diff --git a/cawk.1 b/cawk.1 new file mode 100644 index 0000000..34074d5 --- /dev/null +++ b/cawk.1 @@ -0,0 +1,51 @@ +.TH CAWK "1" "Mar 2022" "CAWK 0.0.1" "REPL calculator in Bash and GNU awk" +.\" Text automatically generated by txt2man +.RS +.SH NAME +\fBcawk \fP- REPL calculator in Bash and GNU awk. +.SH SYNOPSIS +.nf +.fam C + \fBcawk\fP [-f PRECISION] + \fBcawk\fP -e EXPRESSION [-f PRECISION] + COMMAND | \fBcawk\fP [-f PRECISION] + \fBcawk\fP [-f PRECISION] < FILE +.fam T +.fi +.fam T +.fi +.SH DESCRIPTION +When executed whith no arguments, or just with the optional \fB-f\fP PRECISION, \fBcawk\fP enter in REPL mode (\fBR\fPead \fBE\fPval \fBP\fPrint \fBL\fPoop). With \fB-e\fP option, EXPRESSION is evaluated and \fBcawk\fP exits. Expressions lists can also be passed by pipe, here strings, or files (via shell redirection for reading). +.SH OPTIONS +.TP +\fB-e EXPRESSION\fP + +Expression to evaluate. +.TP +\fB-f PRECISION\fP + +Number of positions after decimal point. +.SH COMMANDS (REPL mode) +.TP +\fBf NUMBER\fP + +Redefine precision. +.TP +\fBh\fP or \fB?\fP + +Help. +.TP +\fBq\fP or \fBquit\fP + +Exit. +.SH REPORTING BUGS +https://git.blauaraujo.com/blau_araujo/cawk/issues +.SH AUTHORS +Written by Blau Araujo +.SH COPYRIGHT +Copyright©2022, Blau Araujo. +.PP +License GPLv3+: GNU GPL version 3 or later . +.PP +This is free software: you are free to change and redistribute it. There is NO +WARRANTY, to the extent permitted by law.