o
odinpkg.dev
packages / tool / cmd-calc

cmd-calc

769fdf2tool

A command line tool that calculates the value of an expression

MIT · updated 4 months ago

CMD CALC

A command line tool that calculates the value of an expression.

Description

A simple tool that takes in an expression, calculates the value of it and prints it.

Getting Started

Dependencies

  • All you need to compile this is the odin compiler along with the standard odin packages(core, base, ect)

Installing

  • To build the program, clone the repo and run this command:
odin build cmd-calc
  • If you want you can also add it to path to be able to run it from anywhere

Using the package

  • To use the program, just run it in the command line followed by an expression

  • Note that cmd-calc.exe could also be cmd-calc or cmd-calc.bin

./cmd-calc.exe (20+4*(23/PI)*(23/(e*5)))
  • You can also print the help message
./cmd-calc.exe --help
  • There are also other flags that let you for example visualize the evaluation of the expression
./cmd-calc.exe 2+3-(23/2*5) --tree

Help

It's just odin code, there shouldn't be any major problems apart from the code being bad. If you have a problem maybe try checking your odin version and if it's outdated, update it.

To check the version run this in your command prompt:

odin version

License

Distributed under the MIT License.

TODO

  • More error handling

  • Add an ascii fallback to the tree visualization in case the unicode is broken