rclone_cpp is a C++ library for rclone. Execute rclone commands, add parser to transform the output of command on object, add options to the command, etc.
Most of commands of rclone are supported.
- version
- listremotes
- delete remote
- config
- lsjson
- lsf
- ls
- lsl
- lsd
- lsf
- copyto
- moveto
- delete
- mkdir
- cat
- about
- size
- tree
- bisync
- cleanup
- copyurl
- check
"process" class contains all functions for execute command, get output string, exit code, etc. You can add options to the command using the "basic_option" class. or create your own option class by inheriting from the " basic_option" class. If you want to transform the output of command on object, "parsers" contains many parser for parse the output of command, but if you want to create your own parser, you can do it by inheriting from the "basic_parser" class.
git clone https://github.com/Sudo-Rahman/rclone_cpp.git
cd rclone_cpp
conan create .
After this, the library will be available in your local conan cache.
You need to use conan to import the library in cmake.
ConanFile.txt
[requires]
boost/[>=1.80.0]
rclone_cpp/[>=0.1.0]
[generators]
CMakeDeps
CMakeToolchain
CmakeLists.txt
find_package(rclone_cpp)
find_package(Boost)
target_link_libraries(your_target PRIVATE rclone_cpp::rclone_cpp boost::boost)
#include <iostream>
#include <iridium/entities.hpp>
#include <iridium/parsers.hpp>
#include <iridium/process.hpp>
using namespace std;
using namespace iridium::rclone;
auto main() -> int
{
process::initialize();
auto rclone = new process();
auto remote = entity::remote::create_shared_ptr("test", entity::remote::remote_type::google_drive, "");
auto root_file = entity::file{
nullptr, "/", 0, true, boost::posix_time::second_clock::local_time(),
remote
};
process::add_global_option(option::listing::fast_list());
auto f_parser = parser::file_parser::create(
new parser::file_parser(&root_file,[](const entity::file& file) { std::cout << file << std::endl; })
);
rclone->lsjson(root_file)
.every_line_parser(f_parser)
.execute()
.wait_for_start()
.wait_for_finish();
delete rclone;
return 0;
}