Skip to main content

A simple, elegant terminal calculator with interactive mode

Project description

calcli

A simple, elegant terminal calculator with interactive mode. Perfect for quick math without leaving your terminal.

Quick Start

pip install calcli
calcli

Done. You're in calculator mode.

Usage

Interactive Mode

calcli

Then:

calcli> 5 + 3
8
calcli> 10 * 2.5
25
calcli> 32% of 2,345,454
749090.88
calcli> 5kg to lbs
11.02 lbs
calcli> 25 is what % of 100
25.00%
calcli> h
calcli> exit

Single Calculation

calcli "5 + 3"
# Output: 8

calcli "32% of 100"
# Output: 32

calcli "10km to miles"
# Output: 6.21 miles

Features

Interactive mode — Stay in the calculator, run multiple calculations
Basic math — Add, subtract, multiply, divide, parentheses
Percentages — "32% of 2345454" and "25 is what % of 100" syntax
Unit conversions — 14+ conversions including distance, weight, temperature, volume
Colored output — Clean, readable results
Fast — No GUI overhead, pure terminal speed
History — Type h to see your last 10 calculations with results
Auto-copy — Results are instantly copied to your clipboard
Flexible formatting — Ignore spacing, use commas, drop spaces between numbers and units

Flexible Input

calcli handles messy human input gracefully:

calcli "5+3"              # Works (no spaces)
calcli "5  +  3"          # Works (extra spaces)
calcli "1,000,000 + 500"  # Works (commas ignored)
calcli "5kg to lbs"       # Works (no space needed)
calcli "32% of 100"       # Works
calcli "32 percent of 100"  # Also works

Available Conversions

celsius to fahrenheit      kg to lbs                 miles to km
fahrenheit to celsius      km to miles               ounces to grams
feet to meters             lbs to kg                 grams to ounces
meters to feet             inches to cm              gallons to liters
cm to inches               liters to gallons

Type help in interactive mode to see the full list.

Requirements

  • Python 3.8+
  • colorama (for colored output)
  • pyperclip (for clipboard support)

Installation

From PyPI

pip install calcli

Update to Latest Version

pip install --upgrade calcli

From GitHub

git clone https://github.com/tolaoyelola/calcli.git
cd calcli
pip install -r requirements.txt
pip install -e .

Examples

# Basic math
calcli "100 + 50 * 2"
# Output: 200

calcli "(100 + 50) * 2"
# Output: 300

# Percentages
calcli "15% of 80"
# Output: 12

calcli "what % of 200 is 50"
# Output: 25.00%

# Conversions
calcli "32 celsius to fahrenheit"
# Output: 89.60 fahrenheit

calcli "100kg to lbs"
# Output: 220.46 lbs

calcli "5inches to cm"
# Output: 12.70 cm

Special Commands (Interactive Mode)

help     Show all available commands and conversions
h        Display your last 10 calculations with results
exit     Quit calcli
q        Quit calcli (shorthand)

Contributing

Contributions welcome! Feel free to open issues or submit PRs.

License

MIT — See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

calcli-1.0.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

calcli-1.0.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file calcli-1.0.2.tar.gz.

File metadata

  • Download URL: calcli-1.0.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for calcli-1.0.2.tar.gz
Algorithm Hash digest
SHA256 5f3bdf2e8eaf284c613bf85cf7516e1aa32cda971c5d074285bb142989a709ee
MD5 3b216426712153cba08c4d38e95e449f
BLAKE2b-256 4bcc58136267d23a23f33a100aabee7cc601704d621a31e2c68f428f49b3469b

See more details on using hashes here.

File details

Details for the file calcli-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: calcli-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for calcli-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 694be27a25c189c4434bf0aa2550ebf6387fa2640ad0f5c1a1132c434d187a19
MD5 eb30a79b9fb233934b84f6666d827fcf
BLAKE2b-256 81ada21d82100e235e21577fe98c39edef33d57e9f168fedf2dc7b67c1670ece

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page