oras-project / oras

OCI registry client - managing content like artifacts, images, packages
https://oras.land
Apache License 2.0
1.33k stars 161 forks source link

refactor: make command accessible in option parser #1301

Closed qweeah closed 3 months ago

qweeah commented 3 months ago

Currently options are parsed without any argument

https://github.com/oras-project/oras/blob/e8da6e53ec3a679c966c948e1428ab6a72eee04f/cmd/oras/internal/option/parser.go#L22-L25

All option parser implementations are called in command.PreRunE, where command is actually accessible. Should pass the command to parser to facilitate cmd-specific parsing, e.g. processing the flag set.

qweeah commented 3 months ago

@wangxiaoxuan273 Can you resolve this first since it will simplify change in #1294