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 install . --build=missing
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]
rclone_cpp/[>=0.1.0]
[generators]
CMakeDeps
CMakeToolchain
CmakeLists.txt
find_package(rclone_cpp)
target_link_libraries(your_target PRIVATE rclone_cpp::rclone_cpp)
#include <iostream>
#include <iridium/rclone.hpp>
auto main() -> int
{
process::initialize();
auto rclone = ir::process();
auto remote = ire::remote::create_shared_ptr("test", ire::remote::remote_type::google_drive, "");
auto root_file = ire::file{
nullptr, "/", 0, true, std::chrono::system_clock::now(),
remote
};
process::add_global_option(iro::listing::fast_list());
auto f_parser = irp::file_parser::ptr(&root_file,
[](const ire::file &file)
{
std::cout << file << std::endl;
}, irp::file_parser::json);
rclone.lsjson(root_file)
.every_line_parser(f_parser)
.execute()
.wait_for_start()
.wait_for_finish();
return 0;
}