brandon-rhodes / luca

Bookkeeping in Python
68 stars 16 forks source link

`luca form` should take an output file as an argument #5

Closed zrisher closed 5 years ago

zrisher commented 8 years ago

When using the luca form command as detailed in the walkthrough, but for form f1040:

luca form us.f1040 > 2012-Q1-f1040.json

We receive no error messages, but the generated file 2012-Q1-f941.json has these contents:

Please specify a particular version of this form with a command like:
   luca form us.f1040 2012
   luca form us.f1040 2013
   luca form us.f1040 2014

This is, of course, because the proposed usage is to capture the output of the command to a file. In this case, the command wasn't run properly, so what's saved to the file is the error message instead of the expected contents.

It may be preferable to take an output file name as an argument, so that in cases of incorrect usage the error message can be raised directly to the user. It's hard to imagine a scenario when a user actually wants to see the json output in the console instead of going directly to a file. This would also allow you to have a standard file naming format that obviates the need to enter any file name.

brandon-rhodes commented 8 years ago

That is an interesting idea, and should not be too hard to implement. What do you think the behavior should be if they do not provide a filename?

zrisher commented 8 years ago

We would follow some "standard file naming format" :smile:, probably YYYY-Q-F.json where Q is the quarter, added only for quarterly forms, and F is the form name including the country code minus the period.