From 13bc4d6f60385fc5515e12e368e14b222467f0f9 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 10 Feb 2013 17:41:25 +0100 Subject: [PATCH] brmbar-cli: Add support for adduser action --- brmbar3/SQL | 1 + brmbar3/brmbar-cli.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/brmbar3/SQL b/brmbar3/SQL index 2865c02..1d1d32f 100644 --- a/brmbar3/SQL +++ b/brmbar3/SQL @@ -4,6 +4,7 @@ CREATE TABLE currencies ( name VARCHAR(128) NOT NULL, UNIQUE(name) ); +-- Some code depends on the primary physical currency to have id 1. INSERT INTO currencies (name) VALUES ('Kč'); CREATE TYPE exchange_rate_direction AS ENUM ('source_to_target', 'target_to_source'); diff --git a/brmbar3/brmbar-cli.py b/brmbar3/brmbar-cli.py index df6b078..b6c94dd 100755 --- a/brmbar3/brmbar-cli.py +++ b/brmbar3/brmbar-cli.py @@ -28,6 +28,8 @@ Usage: brmbar-cli.py COMMAND ARGS... stats A set of various balances as shown in the Management screen of the GUI. + adduser USER + Add user (debt) account with given username. ! changestock ITEM1 +-AMT_ITEM1 ITEM2 +-AMT_ITEM2 ... Create a custom transaction that will change balance of a variety of items at once, and either deduce @@ -147,5 +149,10 @@ elif sys.argv[1] == "stats": print("Credit: {}".format(shop.credit_negbalance_str())) print("Inventory: {}".format(shop.inventory_balance_str())) +elif sys.argv[1] == "adduser": + acct = brmbar.Account.create(db, sys.argv[2], brmbar.Currency.load(db, id = 1), 'debt') + acct.add_barcode(sys.argv[2]) # will commit + print("{}: id {}".format(acct.name, acct.id)); + else: help()