Skip to content

Conversation

@alensiljak
Copy link
Contributor

Log informational message if no source specified, otherwise the archive function completes silently without doing anything.

@dnicolodi
Copy link
Collaborator

All the beangulp commands do nothing silently if no source is specified. Why does archvive need special treatment? Operation is logged when something is done, thus if there is no output it is obvious that the command did not do anything. It is convention that commands do not output anything when asked to do nothing.

@alensiljak
Copy link
Contributor Author

alensiljak commented Jun 23, 2025

If "source" is a required parameter, I'd expect a program to tell me that rather than to just complete doing nothing.

@dnicolodi
Copy link
Collaborator

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.

@alensiljak
Copy link
Contributor Author

There a huge difference between providing an empty array and not providing it at all, though.

@dnicolodi
Copy link
Collaborator

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.

@alensiljak
Copy link
Contributor Author

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.
Something like the above commit would be my preference, for example.

@dnicolodi
Copy link
Collaborator

What's the difference between the first version of the proposed patch and the latest? It does exactly the same.

@blais
Copy link
Member

blais commented Jun 23, 2025

Such a trivial issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants