Skip to content

Commit 8d4baaa

Browse files
authored
fix sync add command, help text for other cmds (lneely#82)
Problem was that the way the add sync folder command was handling local and remote path was based on the previous CLI processor, i.e., one string for all args. This patch updates it for CLI11.hpp
1 parent bc1bba6 commit 8d4baaa

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

control_tools.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ void process_commands() {
332332

333333
// crypto subcommands
334334
auto start_crypto_cmd = crypto_cmd->add_subcommand("start", "Start crypto");
335-
std::string crypto_arg;
336-
start_crypto_cmd->add_option("arg", crypto_arg, "Crypto argument")
335+
std::string start_crypto_pwd;
336+
start_crypto_cmd->add_option("password", start_crypto_pwd, "Crypto password")
337337
->required();
338-
start_crypto_cmd->callback([&] { start_crypto(crypto_arg.c_str()); });
338+
start_crypto_cmd->callback([&] { start_crypto(start_crypto_pwd.c_str()); });
339339

340340
crypto_cmd->add_subcommand("stop", "Stop crypto")->callback(stop_crypto);
341341

@@ -345,22 +345,22 @@ void process_commands() {
345345
->callback(list_sync_folders);
346346

347347
auto sync_add_cmd = sync_cmd->add_subcommand("add", "Add sync folder");
348-
std::string syncadd_arg;
349-
sync_add_cmd->add_option("arg", syncadd_arg, "Paths")->required();
348+
std::string syncadd_lpath, syncadd_rpath;
349+
sync_add_cmd->add_option("localpath", syncadd_lpath, "Local Path")->required();
350+
sync_add_cmd->add_option("remotepath", syncadd_rpath, "Remote Path")->required();
350351
sync_add_cmd->callback([&] {
351-
auto [lpath, rpath] = split_paths(syncadd_arg.c_str());
352-
add_sync_folder(lpath, rpath);
352+
add_sync_folder(syncadd_lpath, syncadd_rpath);
353353
});
354354

355355
auto sync_remove_cmd =
356-
sync_cmd->add_subcommand("remove", "Remove sync folder")->alias("rm");
357-
std::string syncrm_arg;
358-
sync_remove_cmd->add_option("arg", syncrm_arg, "Path")->required();
359-
sync_remove_cmd->callback([&] { remove_sync_folder(syncrm_arg.c_str()); });
356+
sync_cmd->add_subcommand("remove", "Remove sync folder (use ls to get folder ID)")->alias("rm");
357+
std::string syncrm_fid;
358+
sync_remove_cmd->add_option("folderid", syncrm_fid, "Folder ID")->required();
359+
sync_remove_cmd->callback([&] { remove_sync_folder(syncrm_fid.c_str()); });
360360

361361
// command loop
362362
while (true) {
363-
std::cout << "> ";
363+
std::cout << "pcloud> ";
364364
std::string line;
365365
if (!std::getline(std::cin, line))
366366
break;

pclsync/pcloudcrypto.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@
4242
#include "pcache.h"
4343
#include "pcloudcrypto.h"
4444
#include "pcrypto.h"
45-
#include "pdiff.h"
4645
#include "pfileops.h"
4746
#include "pfolder.h"
47+
#include "pfs.h"
4848
#include "plibs.h"
4949
#include "pmemlock.h"
5050
#include "pnetlibs.h"
5151
#include "psettings.h"
5252
#include "pssl.h"
53-
#include "pstatus.h"
5453
#include <string.h>
5554
#define PSYNC_CRYPTO_API_ERR_INTERNAL -511
5655

pclsync/pcloudcrypto.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
#define _PCLOUD_CRYPTO_H
3434

3535
#include "papi.h"
36-
#include "pcompiler.h"
3736
#include "pcrypto.h"
38-
#include "pfs.h"
37+
#include "pfsfolder.h"
38+
#include "psynclib.h"
3939

4040
#define PSYNC_CRYPTO_SYM_FLAG_ISDIR 1
4141

0 commit comments

Comments
 (0)