https://pantsbuild.org/ logo
#development
Title
# development
w

wide-midnight-78598

11/05/2022, 2:34 AM
Is it possible to list or filter targets by what goal can be used to run it? Like
./pants list package
would list all targets that are "packagable",
./pants list test
would list all testable targets (without needing to specify the exact target name like "python_test")
b

bitter-ability-32190

11/05/2022, 11:36 AM
That's possible (UX nonwithstanding)
The plugin can request AllTargets, then filter it by taking the union members of those unions (PackageFieldSet and TestFieldSet) and seeing if they are applicable to the target
w

wide-midnight-78598

11/05/2022, 12:45 PM
Ah okay, so there is no current user-facing way to do this. Drats
Was hoping it was currently part of the external introspection API
b

bitter-ability-32190

11/05/2022, 2:08 PM
I can see a case for this as a filtering of the list goal. UX would really be the only concern
Make an issue?
w

wide-midnight-78598

11/05/2022, 2:33 PM
Yep, just oot and aboot right now. Looking for other workarounds too, before potentially adding more to the API. The purpose of this is to be able to contextually select goals based on a target in my vs code plugin
I had also hoped Peek would provide this type of info, but it doesn’t look like there is an external representation of what goals can run on a target, in general
b

bitter-ability-32190

11/05/2022, 3:37 PM
We should probably think about modeling the CLI between stable information-driven script support and intuitive ux-driven user support
w

wide-midnight-78598

11/05/2022, 5:23 PM
Yep, I have a whole thing on this ready for the next meeting. Not the solution, just some notes about my experience, and some interesting user-facing experience(s)