diff --git a/UserGuide.md b/UserGuide.md index 8c52e926..ef240def 100644 --- a/UserGuide.md +++ b/UserGuide.md @@ -215,7 +215,7 @@ Verbosity: You can increase the amount of information given by any command by pa * [`rm`](contrib/docs/commands/rm.md)`[-r] [-f] [--use-pcre] remotepath` Deletes a remote file/folder * [`transfers`](contrib/docs/commands/transfers.md)`[-c TAG|-a] | [-r TAG|-a] | [-p TAG|-a] [--only-downloads | --only-uploads] [SHOWOPTIONS]` List or operate with transfers * [`speedlimit`](contrib/docs/commands/speedlimit.md)`[-u|-d] [-h] [NEWLIMIT]` Displays/modifies upload/download rate limits -* [`sync`](contrib/docs/commands/sync.md)`[localpath dstremotepath| [-dsr] [ID|localpath]` Controls synchronizations. +* [`sync`](contrib/docs/commands/sync.md)`[localpath dstremotepath| [-dpe] [ID|localpath]` Controls synchronizations. * [`sync-ignore`](contrib/docs/commands/sync-ignore.md)`[--show|[--add|--add-exclusion|--remove|--remove-exclusion] filter1 filter2 ...] (ID|localpath|DEFAULT)` Manages ignore filters for syncs * [`exclude`](contrib/docs/commands/exclude.md)`[(-a|-d) pattern1 pattern2 pattern3]` Manages default exclusion rules in syncs. * [`backup`](contrib/docs/commands/backup.md)`(localpath remotepath --period="PERIODSTRING" --num-backups=N | [-lhda] [TAG|localpath] [--period="PERIODSTRING"] [--num-backups=N]) [--time-format=FORMAT]` Controls backups diff --git a/contrib/docs/commands/sync.md b/contrib/docs/commands/sync.md index eb209bb9..d0c62d27 100644 --- a/contrib/docs/commands/sync.md +++ b/contrib/docs/commands/sync.md @@ -1,7 +1,7 @@ ### sync Controls synchronizations. -Usage: `sync [localpath dstremotepath| [-dsr] [ID|localpath]` +Usage: `sync [localpath dstremotepath| [-dpe] [ID|localpath]`
 If no argument is provided, it lists current configured synchronizations.
 
@@ -12,9 +12,12 @@ If an ID/local path is provided, it will list such synchronization
  unless an option is specified.
 
 Options:
--d | --remove ID|localpath	deletes a synchronization.
--s | --disable ID|localpath	stops(pauses) a synchronization.
--r | --enable ID|localpath	resumes a synchronization.
+-d | --delete ID|localpath	deletes a synchronization (not the files).
+-p | --pause ID|localpath	pauses (disables) a synchronization.
+-e | --enable ID|localpath	resumes a synchronization.
+[deprecated] --remove ID|localpath	same as --delete.
+[deprecated] -s | --disable ID|localpath	same as --pause.
+[deprecated] -r ID|localpath	same as --enable.
  --path-display-size=N	Use at least N characters for displaying paths.
  --show-handles	Prints remote nodes handles (H:XXXXXXXX).
  --col-separator=X	Tt will use X as column separator. Otherwise the output will use
diff --git a/src/megacmd.cpp b/src/megacmd.cpp
index f913c96b..297a7805 100644
--- a/src/megacmd.cpp
+++ b/src/megacmd.cpp
@@ -600,19 +600,23 @@ void insertValidParamsPerCommand(set *validParams, string thecommand, se
     }
     else if ("sync" == thecommand)
     {
-        validParams->insert("d");
-        validParams->insert("s");
-        validParams->insert("r");
-
+        validParams->insert("p");
+        validParams->insert("pause");
+        validParams->insert("e");
         validParams->insert("enable");
-        validParams->insert("disable");
-        validParams->insert("remove");
+        validParams->insert("d");
+        validParams->insert("delete");
 
         validParams->insert("show-handles");
         validOptValues->insert("path-display-size");
         validOptValues->insert("col-separator");
         validOptValues->insert("output-cols");
 
+        // Deprecated (kept for backwards compatibility)
+        validParams->insert("remove");
+        validParams->insert("s");
+        validParams->insert("disable");
+        validParams->insert("r");
     }
     else if ("sync-issues" == thecommand)
     {
@@ -1752,7 +1756,7 @@ const char * getUsageStr(const char *command, const HelpFlags& flags)
     }
     if (!strcmp(command, "sync"))
     {
-        return "sync [localpath dstremotepath| [-dsr] [ID|localpath]";
+        return "sync [localpath dstremotepath| [-dpe] [ID|localpath]";
     }
     if (!strcmp(command, "sync-ignore"))
     {
@@ -2538,9 +2542,12 @@ string getHelpStr(const char *command, const HelpFlags& flags = {})
         os << " unless an option is specified." << endl;
         os << endl;
         os << "Options:" << endl;
-        os << "-d | --remove" << " " << "ID|localpath" << "\t" << "deletes a synchronization." << endl;
-        os << "-s | --disable" << " " << "ID|localpath" << "\t" << "stops(pauses) a synchronization." << endl;
-        os << "-r | --enable" << " " << "ID|localpath" << "\t" << "resumes a synchronization." << endl;
+        os << "-d | --delete" << " " << "ID|localpath" << "\t" << "deletes a synchronization (not the files)." << endl;
+        os << "-p | --pause" << " " << "ID|localpath" << "\t" << "pauses (disables) a synchronization." << endl;
+        os << "-e | --enable" << " " << "ID|localpath" << "\t" << "resumes a synchronization." << endl;
+        os << "[deprecated] --remove" << " " << "ID|localpath" << "\t" << "same as --delete." << endl;
+        os << "[deprecated] -s | --disable" << " " << "ID|localpath" << "\t" << "same as --pause." << endl;
+        os << "[deprecated] -r" << " " << "ID|localpath" << "\t" << "same as --enable." << endl;
         os << " --path-display-size=N" << "\t" << "Use at least N characters for displaying paths." << endl;
         os << " --show-handles" << "\t" << "Prints remote nodes handles (H:XXXXXXXX)." << endl;
         printColumnDisplayerHelp(os);
diff --git a/src/megacmdexecuter.cpp b/src/megacmdexecuter.cpp
index 7625b415..ca1b0943 100644
--- a/src/megacmdexecuter.cpp
+++ b/src/megacmdexecuter.cpp
@@ -7686,12 +7686,12 @@ void MegaCmdExecuter::executecommand(vector words, map *clf
             return;
         }
 
-        auto stop = getFlag(clflags, "s") || getFlag(clflags, "disable");
-        auto resume = getFlag(clflags, "r") || getFlag(clflags, "enable");
-        auto remove = getFlag(clflags, "d") || getFlag(clflags, "remove");
+        bool pauseSync = getFlag(clflags, "p") || getFlag(clflags, "pause") || getFlag(clflags, "s") || getFlag(clflags, "disable");
+        bool enableSync = getFlag(clflags, "e") || getFlag(clflags, "r") || getFlag(clflags, "enable");
+        bool deleteSync = getFlag(clflags, "delete") || getFlag(clflags, "d") || getFlag(clflags, "remove");
         bool showHandles = getFlag(clflags, "show-handles");
 
-        if ((stop && (resume || remove)) || (resume && remove))
+        if ((pauseSync && (enableSync || deleteSync)) || (enableSync && deleteSync))
         {
             setCurrentOutCode(MCMD_EARGS);
             LOG_err << "Only one action (disable, enable, or remove) can be specified at a time";
@@ -7729,13 +7729,13 @@ void MegaCmdExecuter::executecommand(vector words, map *clf
                 return;
             }
 
-            if (remove)
+            if (deleteSync)
             {
-                SyncCommand::modifySync(*api, *sync, SyncCommand::ModifyOpts::Remove);
+                SyncCommand::modifySync(*api, *sync, SyncCommand::ModifyOpts::Delete);
             }
             else
             {
-                SyncCommand::modifySync(*api, *sync, resume ? SyncCommand::ModifyOpts::Resume : SyncCommand::ModifyOpts::Stop);
+                SyncCommand::modifySync(*api, *sync, enableSync ? SyncCommand::ModifyOpts::Enable : SyncCommand::ModifyOpts::Pause);
 
                 // Print the updated sync state if we didnt' remove
                 sync = SyncCommand::reloadSync(*api, std::move(sync));
diff --git a/src/sync_command.cpp b/src/sync_command.cpp
index 49b764a5..783c705b 100644
--- a/src/sync_command.cpp
+++ b/src/sync_command.cpp
@@ -269,7 +269,7 @@ void modifySync(mega::MegaApi& api, mega::MegaSync& sync, ModifyOpts opts)
 {
     auto megaCmdListener = std::make_unique(nullptr);
 
-    if (opts == ModifyOpts::Remove)
+    if (opts == ModifyOpts::Delete)
     {
         api.removeSync(sync.getBackupId(), megaCmdListener.get());
         megaCmdListener->wait();
@@ -286,7 +286,7 @@ void modifySync(mega::MegaApi& api, mega::MegaSync& sync, ModifyOpts opts)
     }
     else
     {
-        auto newState = (opts == ModifyOpts::Stop ? mega::MegaSync::RUNSTATE_SUSPENDED : mega::MegaSync::RUNSTATE_RUNNING);
+        auto newState = (opts == ModifyOpts::Pause ? mega::MegaSync::RUNSTATE_SUSPENDED : mega::MegaSync::RUNSTATE_RUNNING);
 
         api.setSyncRunState(sync.getBackupId(), newState, megaCmdListener.get());
         megaCmdListener->wait();
@@ -294,7 +294,7 @@ void modifySync(mega::MegaApi& api, mega::MegaSync& sync, ModifyOpts opts)
         string errorStr = getErrorString(*megaCmdListener);
         if (errorStr.empty())
         {
-            const char* action = (opts == ModifyOpts::Stop ? "disabled" : "re-enabled");
+            const char* action = (opts == ModifyOpts::Pause ? "paused" : "enabled");
             LOG_info << "Sync " << action << ": " << sync.getLocalFolder() << " to " << sync.getLastKnownMegaFolder();
 
             string syncErrorReason = getSyncErrorReason(*megaCmdListener);
@@ -305,7 +305,7 @@ void modifySync(mega::MegaApi& api, mega::MegaSync& sync, ModifyOpts opts)
         }
         else
         {
-            const char* action = (opts == ModifyOpts::Stop ? "disable" : "re-enable");
+            const char* action = (opts == ModifyOpts::Pause ? "pause" : "enable");
             LOG_err << "Failed to " << action << " sync " << getSyncId(sync) << " (" << errorStr << ")";
         }
     }
diff --git a/src/sync_command.h b/src/sync_command.h
index 2c7a095d..ec2c746b 100644
--- a/src/sync_command.h
+++ b/src/sync_command.h
@@ -36,9 +36,9 @@ namespace SyncCommand
 
     enum class ModifyOpts
     {
-        Stop,
-        Resume,
-        Remove
+        Pause,
+        Enable,
+        Delete
     };
 
     void modifySync(mega::MegaApi& api, mega::MegaSync& sync, ModifyOpts opts);