Skip to content

NoPointExc/dbc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

$dbc - $Dollar Calculator CLI

A command-line calculator for dollar number calculations with flexible number format support.

Features

  • Basic Math Operations: +, -, *, /, %
  • Mathematical Functions: sqrt(x), pow(base, exp), abs(x), max(a, b), min(a, b)
  • Real-Time Stock Prices: Use $SYMBOL as a variable to fetch the current market price
    • $AAPL, $TSLA, $BTC-USD
  • Flexible Number Formats: Supports $ prefix and comma separators
    • $1,420,368.94
    • 1,420,368.94
    • 1420368.94
  • Format Preservation: Output matches the format (dollar sign, commas, decimal precision) of the first number in the expression.
  • Interactive REPL Mode: Enter expressions interactively.
  • One-Shot Mode: Evaluate expressions directly from command-line arguments.

Installation

Via Homebrew (macOS/Linux)

brew tap NoPointExc/homebrew-tap
brew install dbc

From Source (Requires Rust)

git clone https://github.com/NoPointExc/dbc.git
cd dbc
cargo install --path .

Usage

One-Shot Mode (Command-Line Arguments)

Pass an expression as arguments to evaluate it and exit:

dbc '$AAPL'
# Output: $247.99

dbc '$1,000 + $AAPL'
# Output: $1,247.99

dbc "400 * 5%"
# Output: 20

Tip: Always use single quotes ('...') or double quotes ("...") around expressions in your shell to avoid interpretation of characters like $ or *.

Interactive Mode

Run dbc without arguments to enter the interactive REPL:

dbc

Interactive Commands

Command Description
/help Show help message
/clear Clear the screen
/exit Exit the calculator
# Start a comment (everything after # is ignored)

Examples

> $AAPL
$247.99

> $1,000 + $AAPL
$1,247.99

> 400 * 4%
16

Number Format Handling

Input Parsed Value
$1,420,368.94 1420368.94
1,420,368.94 1420368.94
1420368.94 1420368.94

Output format matches the first operand in the expression.

License

MIT

About

$bc but for $dollor$

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages