microsoft / microsoft/winget-cli

Replace if exists command

Open
#3,163 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Feature
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Description of the new feature / enhancement

I think a winget replace would be helpful to uninstall a package if it exists and install another to replace it.

An example could be to replace chrome browser with Firefox browser.

Proposed technical implementation details

the call & parameters would be:

Winget replace --uninstall-id --install-id

The programming flow would be something like:

if ($uninstall-id exists){
  Winget uninstall $uninstall-id
  $result = Winget install $install-id
  if($result -ne “successfully installed”){
    Winget install $uninstall-id
}

Example Winget call would be:

Winget replace --uninstall-id Google.Chrome --install-id Mozilla.Firefox

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing uninstall and install command behavior and the CLI's command conventions; the issue names no files, entry points, or tests. Done requires an agreed replace command with defined handling for an absent package, installation failure, and rollback, followed by validation of those cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.