Allow adding multiple tickers via CLI

kivy_mainline_and_py3.8
Tyler Goodlet 2018-04-25 09:10:57 -04:00
parent ec2884a556
commit 7aa99019cb
1 changed files with 5 additions and 4 deletions

View File

@ -206,11 +206,12 @@ def load(ctx, data):
@watchlists.command(help='add ticker to watchlist') @watchlists.command(help='add ticker to watchlist')
@click.argument('name', nargs=1, required=True) @click.argument('name', nargs=1, required=True)
@click.argument('ticker_name', nargs=1, required=True) @click.argument('ticker_names', nargs=-1, required=True)
@click.pass_context @click.pass_context
def add(ctx, name, ticker_name): def add(ctx, name, ticker_names):
watchlist = wl.add_ticker(name, ticker_name, for ticker in ticker_names:
ctx.obj['watchlist']) watchlist = wl.add_ticker(
name, ticker, ctx.obj['watchlist'])
wl.write_to_file(watchlist, ctx.obj['path']) wl.write_to_file(watchlist, ctx.obj['path'])