radix-calc

Crates.ioradix-calc
lib.rsradix-calc
version1.0.3
sourcesrc
created_at2017-06-04 20:11:32.018226
updated_at2017-06-16 21:21:50.99096
descriptiona CLI programmer's calculator written in Rust, with an Alfred workflow
homepage
repositoryhttps://github.com/goodell/radix-calc
max_upload_size
id17729
size37,679
Dave Goodell (goodell)

documentation

README

Travis CI build status

radix-calc

This is a simple programmer's calculator written in Rust. It can be used directly on the command line as an alternative to printf "0x%x\n" $(( ... )) shell expressions, though it's main purpose is to support an Alfred workflow.

Examples

$ radix-calc 5+5
10

$ radix-calc '5 + 0xa - 0o17 * 0b11'
-30

$ radix-calc --bin "0b0110 ^ 0xc"
0b1010

$ radix-calc --all "0b0110 ^ 0xc"
10
0xa
0o12
0b1010

For better ergonomics I often abbreviate radix-calc as rc in my shell startup files:

alias rc=radix-calc

Alfred Workflow

One of the main reasons that radix-calc was developed was to power an Alfred workflow. That workflow bundles the radix-calc binary, so it may not work on older versions of OS X / macOS (as of the time of this writing I only have have access to 10.12 "Sierra" machines).

Alfred Workflow screenshot "5+0b1_0110"

To install it, just open the radix-calc.alfredworkflow file either downloaded directly from GitHub or from a cloned version of the repository.

Future Enhancements

  • convert all signed integer arithmetic to use wrapping_add() and friends to avoid undefined behavior?
  • toggle type width/signedness with shift/option/ctrl/cmd modifier keys?

Author

Dave Goodell dave@goodell.io Twitter: @davidjgoodell

The main calculator icon is from Aiconica, licensed CC0 1.0. The dec/hex/oct/bin icons are original and also CC0 1.0.

License

MIT License, see the LICENSE file.

Commit count: 41

cargo fmt