Wsync

🧭 Presentation #

Wsync is a CLI synchronization client for the W wiki engine. It mostly target advanced users.

Goals are:

Usage is only documented in the README.

Interface is very inspired by the Git command. Page primary content of selected pages is saved as markdown .md file in a local folder.

📷 Screenshots #

Better than screenshots, a little demo video:

🔩 Installation #

Download the binary file that match your OS:

🐧 Linux

💻️ Most Desktop Linux (AMD64)

download wsync-linux-amd64

🍓 ARM based Linux (Raspberry Pi...)

download wsync-linux-arm64

🍏 Mac OS

⛰️ Recent Mac with Apple Silicon processor

download wsync-macos-arm64

🏔️ Older Mac with Intel processor

download wsync-macos-amd64

🪟 Windows

download wsync-windows-amd64.exe

Add it to your PATH renamed as wsync and make it executable.

For example, on linux, you can put it inside ~/.local/bin/. And make it exacutable using chmod +x wsync (once renamed as wsync). The command will then be only accessible by your user.

Building from sources

Clone the repo: https://github.com/vincent-peugnet/wsync.git

Then, type make to run the build.

💡 Tips #

Wsync itself is limited, but it can be combined with other POSIX tools to achieve more complex workflows.

Create an alias

Launching Wsync depend on your current working directory. To trigger sync more independently, you may want to create an alias that would take advantage of the -C flag (to override working directory).

On Ubuntu or Debian Linux distribution, you can edit your ~/.bashrc file to add the following line:

alias SITENAME='wsync -C PATH'

With SITENAME being a nickname of your site and PATH the directory that you choosed for sync.

Watch folder updates

We can use fswatch command to detect changes on our local files. If it occured, we could then push the modifications to the server.

fswatch --event Updated *.md | xargs -I wsync push

The code above will trigger a push everytime a local markdown file is updated.

Repeated synchronization

A shell script could use a loop to trigger the sync regularly. In the following example, notify-send is also used to send a visual notification.

#!/bin/sh
while true
do
notify-send "$(wsync -C REPO_PATH sync)"
sleep 1000 # every 1000 seconds
done

FreeDesktop integration

To go even further, we can use the FreeDesktop [Desktop Entry] standard to create a button or add it to the system menu. This can also be autostarted during session lauch using Autostart.

Here is an example of what it would look like:

[Desktop Entry]
Type=Application
Terminal=false
Name=NAME
Icon=utilities-terminal
Exec=PATH_TO_THE_SCRIPT