irongit

Configure synchronization of files and directories through a plugin.

60 lines2.8 KBLua
1---A file or folder to use with rsync
2---Keep in mind that slash matters. A final slash means to use the contents so you most likely want to use slashes at the end of folders.
3---
4---A file or folder to use with rsync.
5---⚠️ A trailing slash means \"sync the contents\" — without it, rsync syncs the whole folder.
6---You usually want a slash at the end (e.g., `"~/.dotfiles/nvim/"`)
7---@class RsyncPath : string
8
9---@alias ReverseSyncOnSpawn boolean @[default=true]
10
11---@alias RsyncFlag
12---| "-a" # archive: preserve everything
13---| "--delete" # delete files not in source
14---| "-v" # verbose output
15---| "-z" # compress during transfer
16---| "--dry-run" # simulate the sync
17---| string # allow custom flags too
18
19---@alias LogLevel
20---| "trace" show trace logs
21---| "debug" show debug logs
22---| "info" show info logs
23---| "error" show error logs
24---| "off" turn off logs
25
26---Ex: `--exclude-from='.gitignore'`
27---@alias ExcludeFrom string @[default=".gitignore"] Adds --exclude-from in rsync
28
29---A match to use for syncing using files or folders.
30---
31---Ex: `{"~/.dotfiles/nvim/", "~/.config/nvim/"}` sync everything within `~/.dotfiles/nvim/` into `~/.config/nvim/`
32---@class SyncmapWatchItem
33---@field [1] RsyncPath @[required] Path to sync from
34---@field [2] RsyncPath @[required] Path to sync to
35---@field reverse_sync_on_spawn? ReverseSyncOnSpawn @[default=parent.reverse_sync_on_startup]
36---@field rsync? RsyncFlag[] @[default=parent.rsync] Flags to use with rsync
37---@field exclude_from? ExcludeFrom @[default=parent.exclude_from]
38
39---Configurations for syncmap
40---@class SyncmapOpts
41---@field map? SyncmapWatchItem[] @[default={}] The folders and files to keep synchronized
42---@field reverse_sync_on_startup? ReverseSyncOnSpawn
43---@field rsync? RsyncFlag[] @[default={"-a", "--delete"}] Rsync flags that will be used if a map item doesn't include anything. I.E. Default flags
44---@field log_level? LogLevel @[default="error"] Sets the log level for syncmap
45---@field exclude_from? ExcludeFrom
46
47---Final config used in the plugin code. Use `SyncmapOpts` for your config
48---@class FinalSyncmapOpts
49---@field map SyncmapWatchItem[] @[default={}] The folders and files to keep synchronized
50---@field reverse_sync_on_startup ReverseSyncOnSpawn
51---@field rsync RsyncFlag[] @[default={"-a", "--delete"}] Rsync flags that will be used if a map item doesn't include anything. I.E. Default flags
52---@field log_level LogLevel @[default="error"] Sets the log level for syncmap
53---@field exclude_from? ExcludeFrom
54
55---Parameters pased into rsync methods
56---@class RsyncParams
57---@field src RsyncPath Source path to sync from
58---@field dst RsyncPath Destination path to sync from
59---@field flags? RsyncFlag[] @[default={}] Flags used while running rsync. Default to {} for safety precautions.
60---@field reverse_sync_on_spawn ReverseSyncOnSpawn