urfave / cli

A simple, fast, and fun package for building command line apps in Go
https://cli.urfave.org
MIT License
21.89k stars 1.69k forks source link

reorder flags so they can come after arguments #1928

Open fiatjaf opened 3 days ago

fiatjaf commented 3 days ago

What type of PR is this?

What this PR does / why we need it:

This brings back (and improves) the reorderFlags function from v1 that allows flags to be specified after arguments and still work. It's a very much requested feature, see https://github.com/urfave/cli/issues/1733 and https://github.com/urfave/cli/issues/976.

Which issue(s) this PR fixes:

Fixes #976

Testing

I've done some manual testing.

skelouse commented 3 days ago

I did something similar in another repo if you need this: https://github.com/urfave/cli/issues/1583#issuecomment-1385733549