summaryrefslogtreecommitdiff
path: root/fracture
diff options
context:
space:
mode:
Diffstat (limited to 'fracture')
-rw-r--r--fracture/__main__.py14
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"],