summaryrefslogtreecommitdiff
path: root/fracture/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'fracture/__main__.py')
-rw-r--r--fracture/__main__.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/fracture/__main__.py b/fracture/__main__.py
index 5177a27..ee26bbe 100644
--- a/fracture/__main__.py
+++ b/fracture/__main__.py
@@ -139,9 +139,10 @@ def summarize(xlsx=False, year=None, quarter=None):
wrtr.writerow(r)
@command
-def dump(id):
- id, series, type = id
- print(Invoice.load(int(id), int(series), type).to_json())
+def render(id, type=None):
+ invoice = Invoice.load_by_idrepr(id, type)
+ if invoice is not None:
+ print(invoice.to_json())
if __name__ == "__main__":
load_config()
@@ -174,11 +175,14 @@ if __name__ == "__main__":
summary_parser.set_defaults(func=summarize)
# Dump invoice
- summary_parser = subparsers.add_parser("dump", aliases=["d"],
- help="Display chosen template")
- summary_parser.add_argument("id", nargs="+", type=str,
- help="Invoice to render")
- summary_parser.set_defaults(func=dump)
+ summary_parser = subparsers.add_parser("render", aliases=["rend", "r"],
+ help="Render chosen invoice in json format")
+ summary_parser.add_argument("id", nargs="?", type=str,
+ help="Invoice identification string")
+ summary_parser.add_argument("--type", type=str,
+ help="Invoice type", default="sent")
+
+ summary_parser.set_defaults(func=render)
# parse
args = parser.parse_args()