se-edu/addressbook-level3

Give a warning when a parameter is repeated in a user command

Closed this issue · 0 comments

Currently, if the same parameter is repeated multiple times in a command, all except the last occurrence are ignored silently.

e.g., add n/John Doe p/98765432 e/johnd@example.com a/John street p/112345678 (112345678 is taken as the phone number; p/98765432 is ignored)

This allows the user to correct a typo in a previous parameter by quickly retyping it in the command, rather than going back and editing the previous incorrect version of it.

However, this can cause certain user errors to go unnoticed e.g., if the user used a wrong parameter prefix, resulting in the same prefix appearing multiple times in the command.

Suggestion: Give a friendly warning to the user when a parameter is being ignored.
Alternative: Treat repeated parameters as an error.