Commit 23b033e
authored
Enable Explicit toggling for sources (i.e. Enable/Disable) (microsoft#5904)
<!-- To check a checkbox place an "x" between the brackets. e.g: [x] -->
- [x] I have signed the [Contributor License
Agreement](https://cla.opensource.microsoft.com/microsoft/winget-pkgs).
- [x] I have updated the [Release Notes](../doc/ReleaseNotes.md).
- [x] This pull request is related to an issue.
-----
Closes microsoft#5797
This issue was related to enabling/disabling a source without removing
it. Functionally in WinGet this is already captured with the "Explicit"
property, where a source is not included unless it is explicitly
referenced. This is effectively equivalent to a "disabled" source. In
examining this problem we determined the best way to resolve this is to
allow editing of a source's properties, specifically the "Explicit"
property, without having to remove and re-add a source, which is
problematic with default sources. This PR implements that solution to
allow editing of a Source's properties, starting with the Explicit
property. This works on User defined sources and Default sources. In
terms of policy, Edit follows Remove; if you can remove a source you can
edit that source. If you cannot remove the source, then you cannot edit
the source either.
This PR Introduces a new experimental feature, "**sourceEdit**" which
has this new editing behavior. The user experience is not final so we
are keeping it behind sourceEdit for now for testing and refinement.
**New functionality: source edit subcommand**
This allows a source to be edited without removing/readding. This
currently only supports the "Explicit" property of a source, and
includes User sources and Default sources (such as the winget-font
source).
Aliases for this command: `set` and `config`
Example1: `winget source edit -n winget --explicit true`
This will make the winget source explicit.
Example2: `winget source edit -n winget-font -e false`
This will make the winget-font source no longer explicit.
This interface is probably going to change later, which is one of the
reasons why we are using the experimental feature.
Key implementation detail is the addition of an "IsOverride" property to
the SourceDetailsInternal which functions similar to IsTombstone, only
instead of deleting the source it overrides some of the source's
properties, currently the "Explicit" property. This is needed for the
Default sources. For user sources the update is straightforward.
<img width="504" height="110" alt="image"
src="https://github.com/user-attachments/assets/d4d16dd2-61d7-460b-ba3e-310fbdb499e9"
/>
**Tested**
* Added CLI tests for the default source override validation
* Added E2E tests for the command validation
* Manual verification of the command functionality.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/winget-cli/pull/5904)1 parent 21b685c commit 23b033e
File tree
42 files changed
+925
-4
lines changed- doc
- src
- AppInstallerCLICore
- Commands
- Workflows
- AppInstallerCLIE2ETests
- Interop
- AppInstallerCLIPackage
- AppInstallerCLITests
- AppInstallerCommonCore
- Public/winget
- AppInstallerRepositoryCore
- Public/winget
- Microsoft.Management.Deployment.InProc
- Microsoft.Management.Deployment.OutOfProc
- Microsoft.Management.Deployment.Projection
- Microsoft.Management.Deployment
- Public
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+925
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
3 | 14 | | |
4 | 15 | | |
5 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| |||
410 | 412 | | |
411 | 413 | | |
412 | 414 | | |
| 415 | + | |
| 416 | + | |
413 | 417 | | |
414 | 418 | | |
415 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
315 | 367 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
124 | 140 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
687 | 687 | | |
688 | 688 | | |
689 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
690 | 697 | | |
691 | 698 | | |
692 | 699 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
275 | 309 | | |
276 | 310 | | |
277 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
| |||
0 commit comments