How do you rename a file in a digest?
# plugins
b
How do you rename a file in a digest?
1
f
By making a new
Digest
using one of the
Digest
manipulation types.
use
DigestEntries
to get
FileEntry
instances for each file (and
Directory
for empty directories)
then change the `FileEntry`’s for the files you want to rename
then pass to
CreateDigest
to make a new
Digest
with the renamed files
if you just want to add or remove a prefix to file paths, then there is a higher-level
AddPrefix
and
RemovePrefix
types
There currently isn’t a less low-level way to rename files though. (The
DigestEntries
API could be a basis for such future nicer way of renaming files in Digests though.)
b
That worke! Awesome
w
we’ve discussed adding a high-level imperative “series of mutable commands” type API, but i can’t seem to find a ticket about that.
rather than typing it in slack and then losing it (again!): https://github.com/pantsbuild/pants/issues/15102
1