diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2021-01-25 15:49:30 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2021-01-25 15:49:30 +0100 |
commit | 9849969e2573a0dae454cba82fe389a89939257d (patch) | |
tree | 37c921b44168afbafdb6a72d491c3a272913466c | |
parent | 45e8222d2f657fb4ea1a7208e3145f3815a44763 (diff) |
add duplication command
-rw-r--r-- | fracture/__main__.py | 14 |
1 files changed, 14 insertions, 0 deletions
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"], |