winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Enable Explicit toggling for sources (i.e. Enable/Disable)

Open dkbennett opened this issue 3 weeks ago • 4 comments


Closes #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).

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.

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

dkbennett avatar Dec 01 '25 17:12 dkbennett

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

propertly

These words are not needed and should be removed AAD ABCD abi acl AMap Amd appdata ARMNT asan Baz bitmask bluetooth brk Buf certs cgi CMSG codepage commandline constexpr Cov cswinrt CTL Dbg decompressor dedupe DEFT devhome Dns dsc ERANGE errcode errmsg errstr filemode Finalizers FULLWIDTH fuzzer GES github HINSTANCE hlocal hmac Hyperlink ICONDIR icu idx img inet Intelli iwr JDK LCID lhs LONGLONG LPBYTE LPCWSTR LPDWORD LPSTR LPVOID LPWSTR MAJORVERSION MAXLENGTH MDs MINORVERSION nlohmann NONAME NOUPDATE NTFS ofile oid oop OPTOUT outfile OUTOFMEMORY pdb PDWORD pid PKCS pkix placeholders positionals posix pseudocode PSHOST publickey qword redirector regexes remoting reparse REQS rhs rowid RTTI runspace runtimes SARL savepoint sid sqlite subdir subkey ttl typedef uninitialize uninstallation UNMARSHALING userprofile versioned Webserver website wildcards winreg workaround wsl

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:dkbennett/winget-cli.git repository on the disablesource branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.24/apply.pl' |
perl - 'https://github.com/microsoft/winget-cli/actions/runs/19831601998/attempts/1'

Forbidden patterns :no_good: (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

Should be nonexistent

\b[Nn]o[nt][- ]existent\b
Errors (1)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:x: forbidden-pattern 1

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Dec 01 '25 17:12 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:x: forbidden-pattern 1

See :x: Event descriptions for more information.

These words are not needed and should be removed AAD ABCD abi acl AMap Amd appdata ARMNT asan Baz bitmask bluetooth brk Buf certs cgi CMSG codepage commandline constexpr Cov cswinrt CTL Dbg decompressor dedupe DEFT devhome Dns dsc ERANGE errcode errmsg errstr filemode Finalizers FULLWIDTH fuzzer GES github HINSTANCE hlocal hmac Hyperlink ICONDIR icu idx img inet Intelli iwr JDK LCID lhs LONGLONG LPBYTE LPCWSTR LPDWORD LPSTR LPVOID LPWSTR MAJORVERSION MAXLENGTH MDs MINORVERSION nlohmann NONAME NOUPDATE NTFS ofile oid oop OPTOUT outfile OUTOFMEMORY pdb PDWORD pid PKCS pkix placeholders positionals posix pseudocode PSHOST publickey qword redirector regexes remoting reparse REQS rhs rowid RTTI runspace runtimes SARL savepoint sid sqlite subdir subkey ttl typedef uninitialize uninstallation UNMARSHALING userprofile versioned Webserver website wildcards winreg workaround wsl

Forbidden patterns :no_good: (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

Should be nonexistent

\b[Nn]o[nt][- ]existent\b
If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Dec 01 '25 17:12 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

stringview

These words are not needed and should be removed AAD ABCD abi acl AMap Amd appdata ARMNT asan Baz bitmask bluetooth brk Buf certs cgi CMSG codepage commandline constexpr Cov cswinrt CTL Dbg decompressor dedupe DEFT devhome Dns dsc ERANGE errcode errmsg errstr filemode Finalizers FULLWIDTH fuzzer GES github HINSTANCE hlocal hmac Hyperlink ICONDIR icu idx img inet Intelli iwr JDK LCID lhs LONGLONG LPBYTE LPCWSTR LPDWORD LPSTR LPVOID LPWSTR MAJORVERSION MAXLENGTH MDs MINORVERSION nlohmann NONAME NOUPDATE NTFS ofile oid oop OPTOUT outfile OUTOFMEMORY pdb PDWORD pid PKCS pkix placeholders positionals posix pseudocode PSHOST publickey qword redirector regexes remoting reparse REQS rhs rowid RTTI runspace runtimes SARL savepoint sid sqlite subdir subkey ttl typedef uninitialize uninstallation UNMARSHALING userprofile versioned Webserver website wildcards winreg workaround wsl

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:dkbennett/winget-cli.git repository on the disablesource branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.24/apply.pl' |
perl - 'https://github.com/microsoft/winget-cli/actions/runs/20045622935/attempts/1'

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Dec 08 '25 23:12 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

emptystring

These words are not needed and should be removed AAD ABCD abi acl AMap Amd appdata ARMNT asan Baz bitmask bluetooth brk Buf certs cgi CMSG codepage commandline constexpr Cov cswinrt CTL Dbg decompressor dedupe DEFT devhome Dns dsc ERANGE errcode errmsg errstr filemode Finalizers FULLWIDTH fuzzer GES github HINSTANCE hlocal hmac Hyperlink ICONDIR icu idx img inet Intelli iwr JDK LCID lhs LONGLONG LPBYTE LPCWSTR LPDWORD LPSTR LPVOID LPWSTR MAJORVERSION MAXLENGTH MDs MINORVERSION nlohmann NONAME NOUPDATE NTFS ofile oid oop OPTOUT outfile OUTOFMEMORY pdb PDWORD pid PKCS pkix placeholders positionals posix pseudocode PSHOST publickey qword redirector regexes remoting reparse REQS rhs rowid RTTI runspace runtimes SARL savepoint sid sqlite subdir subkey ttl typedef uninitialize uninstallation UNMARSHALING userprofile versioned Webserver website wildcards winreg workaround wsl

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:dkbennett/winget-cli.git repository on the disablesource branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.24/apply.pl' |
perl - 'https://github.com/microsoft/winget-cli/actions/runs/20108938188/attempts/1'

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Dec 10 '25 18:12 github-actions[bot]