Skip to content

Commit

Permalink
#75 added post command to root level
Browse files Browse the repository at this point in the history
  • Loading branch information
epogrebnyak committed Jan 13, 2024
1 parent f379d59 commit 2c334d0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
13 changes: 13 additions & 0 deletions abacus/typer_cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
app.add_typer(ledger, name="ledger")
app.add_typer(show, name="show")

from .post import postx

@app.callback()
def callback():
"""
Typer app, including Click subapp
"""

@app.command()
def init(company_name: Optional[str] = None, overwrite: bool = False):
Expand All @@ -27,6 +34,9 @@ def init(company_name: Optional[str] = None, overwrite: bool = False):
sys.exit(exit_code)





@app.command()
def report(
balance_sheet: Annotated[
Expand Down Expand Up @@ -64,3 +74,6 @@ def unlink(

else:
...

combined_typer_click_app = typer.main.get_command(app)
combined_typer_click_app.add_command(postx, "post")
18 changes: 18 additions & 0 deletions abacus/typer_cli/post.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import click

@click.command(name="post")
@click.option("--entry", type=(str, str, int), multiple=True)
@click.option("--debit", type=(str, int), multiple=True)
@click.option("--credit", type=(str, int), multiple=True)
@click.option("--strict", is_flag=True, default=False)
def postx(entry, debit, credit, strict):
"""Post accounting entries to ledger."""
print(entry)
print(debit)
print(credit)
print(strict)
# chart = get_chart()
# store = get_store()
# entries = CompoundEntry(debits=debit, credits=credit).to_entries(chart.null_account)
# store.append_many(entries)

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ packages = [
]

[tool.poetry.scripts]
bx = 'abacus.typer_cli:app'
bx = 'abacus.typer_cli.app:combined_typer_click_app'
abacus = 'abacus.cli:cx'
codeblock = 'helper.codeblock:main'

Expand Down
Empty file added readme.sh
Empty file.

0 comments on commit 2c334d0

Please sign in to comment.