https://pantsbuild.org/ logo
#general
Title
# general
l

loud-laptop-17949

12/05/2022, 8:53 PM
Is there a way to get
./pants list
to output only filenames and not the owning target name as well?
f

fresh-cat-90827

12/05/2022, 9:28 PM
not sure if that's what you want?
Copy code
❯ ./pants list helloworld:: | xargs ./pants filedeps 
helloworld/BUILD
helloworld/__init__.py
helloworld/greet/BUILD
helloworld/greet/__init__.py
helloworld/greet/greeting.py
helloworld/greet/greeting_test.py
helloworld/greet/translations.json
helloworld/main.py
helloworld/translator/BUILD
helloworld/translator/__init__.py
helloworld/translator/translator.py
helloworld/translator/translator_test.py
On https://github.com/pantsbuild/example-python
Copy code
❯ ./pants filedeps helloworld/translator:
helloworld/translator/BUILD
helloworld/translator/__init__.py
helloworld/translator/translator.py
helloworld/translator/translator_test.py
l

loud-laptop-17949

12/05/2022, 9:52 PM
filedeps is helpful, I am just trying to avoid having do do this all the time:
./pants list .... | cut -d: -f1
f

fresh-cat-90827

12/05/2022, 10:08 PM
I get it. We ended up writing a simple plugin with a new goal just for this 🙂
c

curved-television-6568

12/05/2022, 10:43 PM
using
./pants peek | jq ...
but that’s hardly easier than piping through
cut
..
1
f

fresh-cat-90827

12/05/2022, 10:43 PM
well at least JSON, perhaps a tad more readable
c

curved-television-6568

12/05/2022, 10:46 PM
.. oh, I meant to use a jq query to just output the filenames..
Copy code
╰─❯ ./pants peek src/python/pants/backend/docker:: | jq -r '.[]|.sources[]'
src/python/pants/backend/docker/__init__.py
src/python/pants/backend/docker/package_types.py
src/python/pants/backend/docker/register.py
src/python/pants/backend/docker/registries.py
...
1
2 Views