deanishe / alfred-convert

Convert between different units in Alfred

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

automatic entry of 1 into first currency field

Baggydawg opened this issue · comments

The typical finance terminology for foreign exchange would be: USD GBP

The assumption is obviously that the first currency is set to one, however the workflow requires me to type 1 each time for a conversion.

Would it be possible to update the workflow so it recognises the first item in the currency pair will be set to 1 should the user not specify otherwise?

The typical finance terminology for foreign exchange would be: USD GBP

This isn't a "currency conversion" workflow, it's a "unit conversion" workflow. Currencies are just another unit, so FOREX conventions aren't really interesting for determining the workflow's behaviour.

That's true.

In which case if you wouldn't mind, could you point me to where in the code I could edit it myself?

I'd just add an if statement that passes undefined currency units e.g. 'usd eur' through to the same output as '1 usd eur'.

I'd just add an if statement that passes undefined currency units e.g. 'usd eur' through to the same output as '1 usd eur'

It doesn't work that way. The input format is [context] number input-unit [output-unit], so you'd need to edit the query parser to catch a ValueError from Converter.parse_context() and do something like query = '1 ' + query. And that will only work if the first currency doesn't match a context the workflow understands.