From 9849969e2573a0dae454cba82fe389a89939257d Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Mon, 25 Jan 2021 15:49:30 +0100 Subject: add duplication command --- fracture/__main__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'fracture') diff --git a/fracture/__main__.py b/fracture/__main__.py index a4be0b9..649e561 100644 --- a/fracture/__main__.py +++ b/fracture/__main__.py @@ -168,6 +168,12 @@ def to_json(id, type=None): invoice = Invoice.load(id, type) print(invoice.to_json()) +@command +def duplicate(id, type=None): + invoice = Invoice.load(id, type) + num = Invoice.from_config( edit( invoice.to_config() )).persist() + print(num) + if __name__ == "__main__": load_config() @@ -212,6 +218,14 @@ if __name__ == "__main__": help="List available templates, ignores other options.") summary_parser.set_defaults(func=render) + # Duplicate invoice + duplicate_parser= subparsers.add_parser("duplicate", aliases=["dup", "d"], + help="Duplicate existing invoice") + duplicate_parser.add_argument("id", type=str, + help="Invoice identification string") + duplicate_parser.add_argument("--type", type=str, + help="Invoice type", default="sent") + duplicate_parser.set_defaults(func=duplicate) # jsonify json_parser = subparsers.add_parser("json", aliases=["j"], -- cgit v1.2.3