Closed mac-tech closed 6 years ago
You are correct only single dash commands are available atm, but it should be easy to add the others as well.
In the file assets/rsync.flags conains the ubuntu documentation on flags for rsync, and it is parsed with a regex in this file lib/websync/rsyncmetadata.js
Current regex: /^-(\w),?\s+--([\w-]+)\s+(.+)/gm
Switching it out with something like this
^-(?<flag>\w),?\s+--(?<name>[\w-]+)\s+(?<desc>.+)$|^\s*--(?<longflag>[\w-=]+)\s+(?<longdesc>.+)$
or just parse the file twice with separate regexes
/^-(?<flag>\w),?\s+--(?<name>[\w-]+)\s+(?<desc>.+)/gm
^\s*--(?<flag>[\w-=]+)\s+(?<desc>.+)$/gm
May need to do some extra parsing on the frontend and maybe wrap the returned flags with some extra metadata to differentiate single and double dashed commands. You are welcome to make a pull request, I don't see me doing this any time soon, sorry.
Thanks - I'll give it try.
OK, I don't think I can take this on either. For what it's worth - the problem is twofold: Parsing and passing on multi-character flags (e.g.: --delete) and multi-character flags with variables (e.g.: --exclude-from=/path/to/excludes.file).
One option would be to add to the front-end the addition of an "expert" option. You could store that multi-character flag and variable as a complete string inside the JSON file as a separate object under the "tasks" array.
I hope someone picks this up!
would be nice to get this in, especially for --delete :)
Made these changes, restarted websync and the delete flag is now working. https://github.com/furier/websync/pull/39
Here's the command that showed up at the end of my log file. Task finished Successfully! rsync -ah --delete --progress --rsh="ssh -p 22" root@domain.com:/srv/users/user/ /datadrive/server-backups/MBR
I was only concerned with getting the delete flag working, and I saw that https://github.com/mattijs/node-rsync/blob/master/rsync.js has delete handling already built in.
Let me know if I am missing something. In particular, I am looking for --delete (for destructive updates of the remote copy), and overall progress ( --info=progress2) instead of --progress (which shows file chunk copy progress).