From edbc570fc0409fcc0bc12656b3e8fabccc4905d1 Mon Sep 17 00:00:00 2001 From: Yifei Sun Date: Sun, 29 Mar 2026 18:52:45 +0200 Subject: [PATCH] readme: document import command and remote destination sync --- readme.md | 21 ++++++++++++--------- src/program.fs | 16 ++++++++-------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/readme.md b/readme.md index fe78e30..d92db42 100644 --- a/readme.md +++ b/readme.md @@ -106,7 +106,10 @@ Remote operations go through plain `ssh`. File transfer uses `rsync` with `--files-from` to only copy the specific hashed files that are missing. The remote host is expected to have an `osync` binary available in `PATH`, unless you override it with `--from-osync`, `--to-osync`, `--between-osync`, or -`--and-osync`. +`--and-osync`. The value is interpolated into the SSH command string as-is, so +you can pass a multi-word command like `nix run github:user/osync --`. If the +path contains spaces, quote it for the remote shell: +`--from-osync "'/path with spaces/osync'"`. The remote protocol is just `osync extract` over SSH with JSON on stdout. It is not versioned. In practice you should run the same osync build on both sides. @@ -137,24 +140,24 @@ Sync local machine to a remote host: osync sync --to desktop ``` -Compare two remote hosts: +Sync two explicit local directories: ```bash -osync diff --between laptop --and desktop +osync sync --from-dir /tmp/osu-a --to-dir /tmp/osu-b ``` -Sync two explicit local directories: +Use a non-default remote osync command: ```bash -osync sync --from-dir /tmp/osu-a --to-dir /tmp/osu-b +osync sync --from laptop \ + --from-osync /home/user/.local/bin/osync ``` -Use a non-default remote binary path: +Use a nix flake as the remote osync: ```bash -osync sync --from laptop --to desktop \ - --from-osync /home/user/.local/bin/osync \ - --to-osync /home/user/.local/bin/osync +osync sync --from laptop \ + --from-osync 'nix run github:user/osync --' ``` Dump the local extracted state as JSON: diff --git a/src/program.fs b/src/program.fs index 23859c6..9a1157c 100644 --- a/src/program.fs +++ b/src/program.fs @@ -17,8 +17,8 @@ type SyncArgs = | [] To of host: string | From_Dir of path: string | To_Dir of path: string - | From_Osync of path: string - | To_Osync of path: string + | From_Osync of command: string + | To_Osync of command: string interface IArgParserTemplate with member this.Usage = @@ -27,8 +27,8 @@ type SyncArgs = | To _ -> "Destination host (SSH hostname or omit for localhost)." | From_Dir _ -> "Override the osu! data directory on the source side." | To_Dir _ -> "Override the osu! data directory on the destination side." - | From_Osync _ -> "Path to osync binary on the source host." - | To_Osync _ -> "Path to osync binary on the destination host." + | From_Osync _ -> "Remote shell command to run osync on the source host." + | To_Osync _ -> "Remote shell command to run osync on the destination host." [] type DiffArgs = @@ -36,8 +36,8 @@ type DiffArgs = | [] And of host: string | Between_Dir of path: string | And_Dir of path: string - | Between_Osync of path: string - | And_Osync of path: string + | Between_Osync of command: string + | And_Osync of command: string interface IArgParserTemplate with member this.Usage = @@ -46,8 +46,8 @@ type DiffArgs = | And _ -> "Second host to compare (SSH hostname or omit for localhost)." | Between_Dir _ -> "Override the osu! data directory for the first host." | And_Dir _ -> "Override the osu! data directory for the second host." - | Between_Osync _ -> "Path to osync binary on the first host." - | And_Osync _ -> "Path to osync binary on the second host." + | Between_Osync _ -> "Remote shell command to run osync on the first host." + | And_Osync _ -> "Remote shell command to run osync on the second host." [] type ImportArgs = -- knotmirror 0.0.1