Help in interactive mode

This commit is contained in:
Christopher Teutsch 2019-05-04 21:05:47 +02:00
parent ea7a9926a2
commit faab574f82
Signed by: iwonder
GPG Key ID: 0EE33D788D50130D
2 changed files with 11 additions and 4 deletions

View File

@ -26,13 +26,13 @@ Reverse conversion direction (EUR to specified currency, instead of specified cu
Calculate interactively on stdin Calculate interactively on stdin
##### `q`, `exit`, `quit`
##### `q` Quit the program.
Quit.
##### `AMOUNT CURRENCY` ##### `AMOUNT CURRENCY`
Convert AMOUNT euros to CURRENCY. Convert AMOUNT euros to CURRENCY.
##### `CURRENCY AMOUNT` ##### `CURRENCY AMOUNT`
Convert AMOUNT CURRENCY to euros. Convert AMOUNT CURRENCY to euros.
##### `d`, `date`
Print the date the data is from.

View File

@ -71,6 +71,13 @@ vals_group.add_argument(
def _process_stdin(argv: str, res: utils.CurrencyResult) -> None: def _process_stdin(argv: str, res: utils.CurrencyResult) -> None:
argv = argv.split() argv = argv.split()
try: try:
if argv[0] in ['h', 'man', 'help']:
print("""Usage:
q | exit | quit: Quit the program.
AMOUNT CURRENCY: Convert AMOUNT euros to CURRENCY.
CURRENCY AMOUNT: Convert AMOUNT CURRENCY to euros.
d | date: Print the date which the data is from.
""")
if argv[0] in ['q', 'exit', 'quit']: if argv[0] in ['q', 'exit', 'quit']:
sys.exit() sys.exit()
elif argv[0] in ['date', 'd']: elif argv[0] in ['date', 'd']: