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 allows winget upgrade --all -v 1.0 (version is used only when upgrading single package, not all of them) or winget 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.
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
upgradecommands 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.