Improve sync syntax for more intuitive folder contents vs folder and contents sync
When you issue a sync command and specify the folder to sync, Indie Web Server inherits its functionality from the underlying rsync program. That is, if you specify the folder with a trailing slash, the contents of the folder are synced. If you do not include the slash, the folder and its contents are synced.
web-server sync my-local-folder my.site --account=me --folder=my-remote-folder
Will result in the following directory structure on the remote server:
So both the folder and its contents will be synced to the destination.
If, however, you start Indie Web Server with:
web-server sync my-local-folder/ my.site --account=me --folder=my-remote-folder
It will result in the following directory structure on the remote server:
And my-remote-folder will contain the contents of my-local-folder.
While this is consistent with how rsync – which is what we’re using under the hood – works, it is far from intuitive.
- Default functionality should be to sync the contents of the folder (99% of the time, this is what you would expect)
- If you want to sync the folder itself along with its contents, you should specify that via a flag. e.g.,