Sypnosis
The program simplifies mathematical expressions using the Go syntax. To enter interpreted
mode, simply call the cr
command. Here's an example:
% cr
(4 + 4) - 2
6
Additionally, there is a flag -e
available to evaluate expressions:
% cr -e '4 / 2'
2
%
Installation
These are generic installation instructions for unix-like systems.
The Makefile included in the 'cr' project automates the building process of the project. To use it,
simply navigate to the project directory and run the following command:
% doas make install -o check
By default, the command installs the executable in /usr/local/bin
. To install it in a different
location, modify the variables of cfg.mk
.
Targets
The Makefile include in the 'cr' project recognizes the following targets to control
how it operates:
build
Compiles the source code, applies linker flags to reduce the binary size, and disables CGO.
It creates an executable binary file named 'cr' in the current directory that can be executed
to run the project.
install
Copy the executable file created by the build target to a system-wide directory
specified by $(GOBIN) variable.
fmt
Format the source code of the project according to the Golang standard formatting
rules. It ensures that the code is well-structured and easy to read.
vet
Check the code for correctness. It detects potential errors and mistakes in the code
and provides suggestions for fixing them.
check
Apply static analysis to the codebase. It detects a wide range of issues, including
code smells, security vulnerabilities, and potential bugs.
To use this target, you must have staticcheck installed on
your system.
Windows users
To build and install the 'cr' project on Windows using cmd, run the following command:
set CGO_ENABLED=0
go install -ldflags="-s -w" git.sr.ht/~nzv/cr@latest
The project will be installed in $GOPATH\bin.
License
All sources implement the BSD-3 license. For additional details, please consult the LICENSE
file.