CLI Calculator Module
src.cli.calculator
This module provides CLI commands for performing basic arithmetic operations.
It uses the typer
library to define commands for addition, subtraction,
multiplication, and division. Each command takes two numbers as input and prints
the result to the console.
The module relies on the core.calculator
module for the actual arithmetic
operations.
add(a, b)
Add two numbers.
PARAMETER | DESCRIPTION |
---|---|
a
|
The first number to add.
TYPE:
|
b
|
The second number to add.
TYPE:
|
Source code in src/cli/calculator.py
subtract(a, b)
Subtract two numbers.
PARAMETER | DESCRIPTION |
---|---|
a
|
The number to subtract from.
TYPE:
|
b
|
The number to subtract.
TYPE:
|
Source code in src/cli/calculator.py
multiply(a, b)
Multiply two numbers.
PARAMETER | DESCRIPTION |
---|---|
a
|
The first number to multiply.
TYPE:
|
b
|
The second number to multiply.
TYPE:
|
Source code in src/cli/calculator.py
divide(a, b)
Divide two numbers. Args: a (float): The numerator. b (float): The denominator.
Source code in src/cli/calculator.py
main(version=typer.Option(None, '--version', '-v', help="Show the application's version and exit.", callback=_version_callback, is_eager=True))
Handles the --version flag