inform user when no source specified#178
inform user when no source specified#178alensiljak wants to merge 2 commits intobeancount:masterfrom
Conversation
|
All the beangulp commands do nothing silently if no source is specified. Why does |
|
If "source" is a required parameter, I'd expect a program to tell me that rather than to just complete doing nothing. |
|
Then the correct solution would be to make the argument required and return an error if it is not provided, and doing so for all commands implemented by beangulp, not just one. However, not making the argument required is a deliberate design choice: command line tools are often invoked with wildcard inputs and they should not error out if the wildcard is empty. This is a very well established convention: if no input is specified, do nothing. |
|
There a huge difference between providing an empty array and not providing it at all, though. |
When passing parameters on the command line, zero or more parameters can be assigned to an argument. There is no such thing as passing an empty array to an argument. |
|
I agree with your conclusion but I still think, using defensive programming, that such case should be explicitly handled rather than implied. Having software that does nothing and hiding required parameters because of the limitations of the command line does not sound like a good practice to me. |
|
What's the difference between the first version of the proposed patch and the latest? It does exactly the same. |
|
Such a trivial issue. |
Log informational message if no source specified, otherwise the archive function completes silently without doing anything.