Implement better validation of how CLI arguments are used together #1788
Labels
Issue-Feature
This is a feature request for the Windows Package Manager client.
Milestone
Description of the new feature / enhancement
The current validation of arguments seems to miss many combinations of arguments that don't make sense together. For example, the
upgrade
commands allowswinget upgrade --all -v 1.0
(version is used only when upgrading single package, not all of them) orwinget upgrade -m myManifest.yaml --accept-source-agreements
(sources are not used with local manifest, so there are no agreements).We should improve that validation, preferably in a way that makes it easier to extend as we add more arguments.
Proposed technical implementation details
I think we could create "categories" of arguments and define the rules on top of them. For example, for upgrade there are arguments for selecting the package (e.g. id, version), arguments for selecting multiple packages (
--all
,--include-unknown
), and arguments for the sources (source name, REST source header, agreements). We could define rules on top of them like disallowing arguments for both single and multiple packages, or for sources when including a local manifest. Adding a new argument to one category would include it in all existing rules easily.The text was updated successfully, but these errors were encountered: