WardrikWorkspace.Writes (wardrik_workspace v0.1.0-rc.1)

Copy Markdown

The file tools that change files: write_file, edit_file and delete_file.

Each change is made over the version read. If another writer got there first, an append, an edit or a delete reads the file again and retries, up to eight times in all.

A written file gets the labels of what the writing run had read. An append or an edit also keeps the file's existing labels.

Files are at most 4 MiB.

Summary

Functions

Deletes a file. The answer says whether it was there.

Replaces text in a file, once or, with all, everywhere it appears.

Writes a whole file over the version read, or appends to its end.

Functions

delete_file(spec, args)

@spec delete_file(WardrikWorkspace.Spec.t(), map()) :: {:ok, map()}

Deletes a file. The answer says whether it was there.

edit_file(spec, args, context)

@spec edit_file(WardrikWorkspace.Spec.t(), map(), WardrikCore.Context.t()) ::
  {:ok, map()}

Replaces text in a file, once or, with all, everywhere it appears.

write_file(spec, args, context)

@spec write_file(WardrikWorkspace.Spec.t(), map(), WardrikCore.Context.t()) ::
  {:ok, map()}

Writes a whole file over the version read, or appends to its end.