microsoft / microsoft/winget-cli

Add alias for user scope flag when installing package.

Open
#2,302 0 comments 0 reactions 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

Add a short command line flag for installing an app with the scope of user. While that is the default scope, it will be implicitly changed if the package requires an admin. Having such a flag makes an early exit if the package in question requires administrator privileges. Otherwise winget runs, and then the user discovers that the package requires admin, which is not an amusing user experience.

If we have the alias for the flag that explicitly forces the package to require user privileges, like -u, we can save the developer from having to try and see whether or not the package supports admin permissions. Of course, the option --scope user can be specified by the developer, but having -u as a short hand way of saying that seems ideal. For example, in NPM you can install a package globally or locally by specifying --location=global or --location=local, but there is -g flag. Of course, NPM doesn't have a local flag because that is the default, but I don't think NPM has the issue of an install being --global implicitly.

Proposed technical implementation details

Have flags, e.g. -g or -u for limiting the scope of the installation of the package to the current user or globally. Those can be documented along with the --scope flag:

 --scope [ user | machine ], -u, -g                      Select install scope (user or machine)

The -m flag is already taken, plus the -g flag would have the benefit of being analogous to e.g. NPM (technically NPM's -g flag is analogous to winget's user scope flag, because it installs the binary for just the current user) . The -l flag for local installation is already taken as well, so -u seems ideal here.

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 tracing the install command's existing --scope option and the currently reserved -m and -l flags. Determine whether -u or -g should alias user scope, then verify that the alias exits early when a package requires administrator privileges and that the selected spelling is documented with --scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.