More explicit errors
This commit is contained in:
parent
6afbc59ef4
commit
e2f67fa552
6
crawl.py
6
crawl.py
@ -79,7 +79,9 @@ def _process_stdin(argv: str, res: utils.CurrencyResult) -> None:
|
||||
sys.exit()
|
||||
elif argv[0] in ['date', 'd']:
|
||||
print(res.date)
|
||||
elif is_float(argv[0]):
|
||||
elif len(argv[0])==3 or len(argv[1])==3:
|
||||
# more than 3 letter abbreviations are invalid
|
||||
if is_float(argv[0]):
|
||||
# amount first -> convert to currency in argv[1]
|
||||
print(fmt_and_calc(
|
||||
cur=argv[1].upper(),
|
||||
@ -93,6 +95,8 @@ def _process_stdin(argv: str, res: utils.CurrencyResult) -> None:
|
||||
amt=float(argv[1]),
|
||||
res=res,
|
||||
direction=DIRECTION_TO_EUR))
|
||||
else:
|
||||
print("Not implemented: '" + " ".join(argv) + "'")
|
||||
except IndexError:
|
||||
if argv is None:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user