Problem
The command-line account setup feature (--userid, --apppassword, --serverurl, --localdirpath, --remotedirpath) currently has two limitations that make it impossible to configure more than one sync folder:
1. Repeated --localdirpath / --remotedirpath arguments are silently ignored
In src/gui/accountsetupcommandlinemanager.cpp, each argument is stored in a single QString member variable (_localDirPath, _remoteDirPath). Passing the same flag multiple times simply overwrites the previous value — only the last pair survives into the setup job.
2. A second invocation is rejected because the account already exists
src/gui/accountsetupfromcommandlinejob.cpp checks whether the account (userid@hostname) is already registered and exits with code 1 if so. This means there is no way to add a second sync folder to an already-configured account via the CLI — not in a single invocation, and not by running the app a second time.
Expected behaviour
It should be possible to configure multiple sync folders for the same account in one CLI invocation, e.g.:
nextcloud \
--userid alice \
--apppassword secret \
--serverurl https://cloud.example.com \
--localdirpath ~/Documents --remotedirpath /Documents \
--localdirpath ~/Photos --remotedirpath /Photos
Suggested fix
- Change
_localDirPath and _remoteDirPath in AccountSetupCommandLineManager from QString to QList<QString>, accumulating each flag value instead of overwriting.
- In
AccountSetupFromCommandLineJob, when the account already exists, skip account creation and proceed directly to folder setup instead of aborting.
- Iterate over all requested folder pairs and call
setupLocalSyncFolder for each one.
A working implementation is available as a pull request.
Affected files
src/gui/accountsetupcommandlinemanager.h / .cpp
src/gui/accountsetupfromcommandlinejob.h / .cpp
Problem
The command-line account setup feature (
--userid,--apppassword,--serverurl,--localdirpath,--remotedirpath) currently has two limitations that make it impossible to configure more than one sync folder:1. Repeated
--localdirpath/--remotedirpatharguments are silently ignoredIn
src/gui/accountsetupcommandlinemanager.cpp, each argument is stored in a singleQStringmember variable (_localDirPath,_remoteDirPath). Passing the same flag multiple times simply overwrites the previous value — only the last pair survives into the setup job.2. A second invocation is rejected because the account already exists
src/gui/accountsetupfromcommandlinejob.cppchecks whether the account (userid@hostname) is already registered and exits with code 1 if so. This means there is no way to add a second sync folder to an already-configured account via the CLI — not in a single invocation, and not by running the app a second time.Expected behaviour
It should be possible to configure multiple sync folders for the same account in one CLI invocation, e.g.:
Suggested fix
_localDirPathand_remoteDirPathinAccountSetupCommandLineManagerfromQStringtoQList<QString>, accumulating each flag value instead of overwriting.AccountSetupFromCommandLineJob, when the account already exists, skip account creation and proceed directly to folder setup instead of aborting.setupLocalSyncFolderfor each one.A working implementation is available as a pull request.
Affected files
src/gui/accountsetupcommandlinemanager.h/.cppsrc/gui/accountsetupfromcommandlinejob.h/.cpp