Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ classifiers = [

dependencies = ["requests>=2.25.1,<3", "dataclasses_json>=0.6.7"]

[project.optional-dependencies]
cli = [
"typer>=0.12.0,<1",
"rich>=13.0.0,<14",
]

[project.scripts]
verda-cli = "verda.cli.main:app"

[dependency-groups]
dev = [
"pytest-cov>=2.10.1,<3",
Expand Down
80 changes: 80 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions verda/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Verda CLI module."""
1 change: 1 addition & 0 deletions verda/cli/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""CLI command modules."""
24 changes: 24 additions & 0 deletions verda/cli/commands/balance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Commands for checking account balance."""

import typer

from verda.cli import main as cli_main
from verda.cli.utils.client import get_client
from verda.cli.utils.errors import handle_api_errors
from verda.cli.utils.output import console, output_json, spinner

app = typer.Typer(no_args_is_help=True)


@app.command('get')
@handle_api_errors
def get_balance() -> None:
"""Get account balance."""
client = get_client()
with spinner('Fetching balance...'):
balance = client.balance.get()

if cli_main.state['json_output']:
output_json({'amount': balance.amount, 'currency': balance.currency})
else:
console.print(f'Balance: [bold green]{balance.currency} {balance.amount:.2f}[/bold green]')
Loading