brmbar-cli: Add support for adduser action

This commit is contained in:
Petr Baudis 2013-02-10 17:41:25 +01:00
parent bacb9b1791
commit 13bc4d6f60
2 changed files with 8 additions and 0 deletions

View file

@ -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()