chocolatey / chocolatey/choco

Verify command line flags (by default)

Open
#3,371 10 comments 0 reactions 0 assignees View on GitHub
Question
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [X] I have verified this is the correct repository for opening this issue.
- [X] I have verified no other issues exist related to my request.

### Is Your Feature Request Related To A Problem? Please describe.

It's easy to mistype any command. When that happens, it's helpful to get an informational error.

Here is an example:
```
choco install visualstudio2022buildtools --fake-command-line-flag
```

Chocolatey doesn't indicate the option is invalid?

Or

```
choco install visualstudio2022buildtools --package-parametersss
```
Almost correct. The same problem. No warning message. No error message. Just a "success".

### Describe The Solution. Why is it needed?

Sanitize command line flags. Return a clear error message "invalid option : X" . Exit with an error code.

It's better to return an error, than to allow the user to mistakenly believe they are getting certain options, but the options were misspelled.

(the proposal is that this should occur 'by default'.)

### Additional Context

_No response_

### Related Issues

_No response_

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating Chocolatey's command-line parsing path and determining how recognized options are tracked across commands. Done means mistyped or unknown flags produce a clear invalid-option error and a nonzero exit code by default, without rejecting valid flags.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
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.