ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
20.85k stars 1.39k forks source link

[Bug] `scoop alias list --verbose` - `--verbose` not recognized #6061

Closed mattcargile closed 1 month ago

mattcargile commented 1 month ago

Bug Report

Current Behavior

scoop alias list --verbose returns scoop alias: Option --verbose not recognized..

Expected Behavior

It should output the Summary property.

Additional context/output

scoop alias list -v and scoop alias list -verbose works. Docs scoop alias --help reflects --verbose.

Possible Solution

I assume it is something with this line.

https://github.com/ScoopInstaller/Scoop/blob/be56faf29016a3bb82f5bc15d3e4621930ea7a38/libexec/scoop-alias.ps1#L42

The edit would be a removal of the comment since verbose is a long option.

$opt, $other, $err = getopt $Args 'v' 'verbose'

Once removed, the other problematic UX, is that scoop alias list -verbose returns scoop alias: Option -e not recognized. which is confusing as a user. I'd expect a return of -verbose isn't an option. I assume this is a bug in getopt.

System details

Windows version: 10

OS architecture: 64bit

PowerShell version: 7.4.3

Additional software:

Scoop Configuration

{
  "last_update": "2024-07-16T23:32:30.2674510-05:00",
  "alias": {
    "finfo": "scoop-finfo",
    "fsearch": "scoop-fsearch"
  },
  "scoop_repo": "https://github.com/ScoopInstaller/Scoop",
  "scoop_branch": "master"
}
lewis-yeung commented 1 month ago

I'd expect a return of -verbose isn't an option. I assume this is a bug in getopt.

That's by design, since the getopt function conforms to the GNU standard for parsing long and short CLI options.

mattcargile commented 1 month ago

I'd expect a return of -verbose isn't an option. I assume this is a bug in getopt.

That's by design, since the getopt function conforms to the GNU standard for parsing long and short CLI options.

It is by design to say Option -e not recognized when a user passes in -verbose? "I didn't pass in any -e" . Or maybe I am missing something?

lewis-yeung commented 1 month ago

@mattcargile Yes. In GNU/POSIX standard, the single-hyphen prefixed -verbose passed by user is parsed as mixed short options: -v, -e, -r, -b, -o, -s and -e again.

mattcargile commented 1 month ago

@mattcargile Yes. In GNU/POSIX standard, the single-hyphen prefixed -verbose passed by user is parsed as mixed short options: -v, -e, -r, -b, -o, -s and -e again.

Ah, of course! That is embarrassing for me. :'-)

Thanks for breaking down. That didn't immediately occur to me.