Actiontypeno test imports ittype Action = "create" | "update" | "unchanged" | "remove";What a planned change does to a file.
Changing a person's file safely (commons data 0047-arcactl-init FR-003): a change is planned first, as a value that says what the file is now, what it would be and the difference, and is applied only where the person agreed. Applying it writes a temporary file beside the target and renames it over, so that a failure leaves the old file; keeps the file's mode (a new file gets the mode asked for, 0600 for a password file); keeps a copy of what the file was the first time it is changed; and, where the file is a symbolic link (a dotfile manager's), writes through it to the file it points at and says so. Where there is nothing to change it writes nothing.
Actiontypeno test imports ittype Action = "create" | "update" | "unchanged" | "remove";What a planned change does to a file.
diffOffunctionfunction diffOf(before: string | undefined, after: string): stringThe difference between two texts as lines, - for a line that goes and + for one that comes (a line common to both is left out, with a line of context kept around a change).
FileErrortypeno test imports ittype FileError = { readonly kind: "block"; readonly path: string; readonly error: BlockError } | { readonly kind: "unreadable"; readonly path: string; readonly why: string };What is wrong with a change.
pgpassModeOkconstconst pgpassModeOk: (mode: number) => booleanWhether a password file's mode is one that libpq will use: it ignores a file that the group or others can read.
planBlockfunctionfunction planBlock(path: string, name: string, style: Style, want: Want, mode?: number): Result<Change, FileError>Plans the change of one file for a block.
| Parameter | What it is |
|---|---|
path | the file |
name | the block's name |
style | the file's comment mark |
want | the body to put in, or absent to take the block out |
mode | the mode of a file that is made new |
Returns: the change, or why it cannot be planned
Wanttypeno test imports ittype Want = { readonly body: string } | "absent";What is wanted of a block: put in with a body, or taken out.
planRemoveFilefunctionno test imports itfunction planRemoveFile(path: string): Result<Change, FileError>Plans removing a file that arcactl owns whole: nothing where it is not there. A directory is refused.
planWholefunctionno test imports itfunction planWhole(path: string, text: string, mode?: number): Result<Change, FileError>Plans the change of a file that arcactl owns whole (its state, its cache): the file is the text, or is made.
| Parameter | What it is |
|---|---|
path | the file |
text | what the file is to hold |
mode | the mode of a file that is made new |
Returns: the change