Changing

edit

Replace one occurrence inside a text file

View as Markdown

Changes something.

Replace one occurrence inside a text file.

Expects revision, the file's observed content revision. The whole edit is done here: the file is read at that revision, find must occur exactly once in its UTF-8 text, and the result is written back. A file whose bytes are not text, or in which find occurs never or more than once, is refused and nothing is written. On revision_conflict nothing was written: read the item again, work out what the change means against what is there now, and run it again with the newly observed revision. Never fetch a fresh revision merely to push a stale change through.

Read a revision from the stat tool, a listing, a search, the status tool, or any change's own result.

This change takes a key you choose, fresh for this change. If its result never reaches you, call again with the same key and the same arguments, or ask the status tool with that key: the same key and the same input is one change, made once.

Arguments

ArgumentTypeRequiredMeaning
file_idtextyesThe file to edit
findtextyesThe text to find, which must occur exactly once
replacetextyesWhat to put in its place
revisiontextyesThe content revision this change expects to find
keytextyesA key you choose for this change, fresh each time; repeat it to settle a lost result

On the command line

flie agent edit FILE_ID --find OLD --replace NEW --revision REV [--key OPERATION_KEY]
flie --json agent edit FILE_ID --find OLD --replace NEW --revision REV   # one occurrence

On this page