pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.29k stars 628 forks source link

Track unconsumed args by positional context. (cherry-pick of #21424) #21427

Closed benjyw closed 2 weeks ago

benjyw commented 2 weeks ago

This is a slight change to the arg consumption tracking in the native parser, so that unconsumed args are now reported per positional context (i.e., global vs goal scope).

This is so we can wire this in to the existing handling of such errors, which expects to know about the scoping so it can choose which flags to consider for "did you mean" computation.

This change also moves the check for unconsumed args into a central function, in preparation for the switch to native parsing.

benjyw commented 2 weeks ago

I had to manually cherrypick because it turns out the previous PR cherrypick wasn't merged, so this needs a rubber stamp. Thanks!