Minor template refactor and cli.py user interface enhancement #5
12
README.md
12
README.md
|
@ -58,12 +58,12 @@ python3 cli.py user add username password
|
||||||
Add some products with:
|
Add some products with:
|
||||||
|
|
||||||
```
|
```
|
||||||
python3 cli.py product add "Birra media" 300
|
python3 cli.py product add "Birra media" 3
|
||||||
python3 cli.py product add "Birra grande" 400
|
python3 cli.py product add "Birra grande" 4
|
||||||
python3 cli.py product add "Cocktail" 500
|
python3 cli.py product add "Cocktail" 5
|
||||||
python3 cli.py product add "Vino" 400
|
python3 cli.py product add "Vino" 4
|
||||||
python3 cli.py product add "Amaro" 200
|
python3 cli.py product add "Amaro" 2
|
||||||
python3 cli.py product add "Acqua" 100
|
python3 cli.py product add "Acqua" 0.5
|
||||||
```
|
```
|
||||||
|
|
||||||
And finally add and event you can play with:
|
And finally add and event you can play with:
|
||||||
|
|
3
cli.py
3
cli.py
|
@ -289,10 +289,11 @@ def tabulate_products(products):
|
||||||
|
|
||||||
@product.command('add')
|
@product.command('add')
|
||||||
@click.argument('name')
|
@click.argument('name')
|
||||||
@click.argument('price')
|
@click.argument('price', type=float)
|
||||||
@click.option('-s', '--sort', type=click.INT)
|
@click.option('-s', '--sort', type=click.INT)
|
||||||
@click.option('-c', '--category', type=click.INT)
|
@click.option('-c', '--category', type=click.INT)
|
||||||
def product_add(name, price, sort, category):
|
def product_add(name, price, sort, category):
|
||||||
|
price = int(price * 100)
|
||||||
product = Product(name=name, price=price)
|
product = Product(name=name, price=price)
|
||||||
|
|
||||||
if sort:
|
if sort:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user