Project

General

Profile

« Previous | Next » 

Revision 4fd46efa

Added by david.sorber over 2 years ago

Change "disable-log" option to "enable-log" and make the log disabled by
default. Also add a warning if unsupported directory entries are
detected while copying. Version: v0.2.1.

View differences:

src/copytool_main.cc
namespace sfs = std::filesystem;
const std::string VERSION("v0.2.0");
const std::string VERSION("v0.2.1");
const std::string BOLD{"\033[1m"};
const std::string ENDC{"\033[0m"};
......
->check(CLI::ExistingDirectory);
// Logging related options
bool disableLog = DBS::CopyManagerOptions::DEFAULT_DISABLE_LOG;
bool enableLog = DBS::CopyManagerOptions::DEFAULT_ENABLE_LOG;
bool logToStderr = DBS::CopyManagerOptions::DEFAULT_LOG_TO_STDERR;
std::string logFilePath{DBS::CopyManagerOptions::DEFAULT_LOG_FILE_PATH};
int logLevel = DBS::CopyManagerOptions::DEFAULT_LOG_LEVEL;
// Add logging options
app.add_flag("--disable-log", disableLog, "disable (do not output) log");
app.add_flag("--enable-log", enableLog, "enable the log (default: disabled)");
app.add_flag("--log-to-stderr", logToStderr, "write log messages to stderr");
app.add_option("-l,--log-file-path", logFilePath, "log file path");
app.add_option("--log-level", logLevel,
......
bool copyTopLevel = DBS::CopyManagerOptions::DEFAULT_COPY_TOPLEVEL;
app.add_option("--flow-control-threshold", flowControlThreshold,
"flow control threshold")
"flow control threshold (default: "
+ std::to_string(flowControlThreshold) + ")")
->check(CLI::Range(100,65535));
app.add_option("-n,--num-copy-threads", numCopyThreads,
"number of copy threads to spawn (default: 4)")
"number of copy threads to spawn (default: "
+ std::to_string(numCopyThreads) + ")")
->check(CLI::Range(1, 512));
app.add_flag("--copy-top-level", copyTopLevel,
"copy top level source directory to destination rather then "
......
// Build options object
DBS::CopyManagerOptions options(srcPath,
destPath,
disableLog,
enableLog,
logToStderr,
logFilePath,
logLevel,
......
// The callback structure requires a global
indicators::BlockProgressBar pBarEta{
indicators::option::BarWidth{80},
indicators::option::Start{"["},
indicators::option::End{"]"},
indicators::option::PrefixText{"Complete: "},
indicators::option::ShowElapsedTime{true},
indicators::option::ShowRemainingTime{true},
indicators::option::BarWidth{80},
indicators::option::Start{"["},
indicators::option::End{"]"},
indicators::option::PrefixText{"Complete: "},
indicators::option::ShowElapsedTime{true},
indicators::option::ShowRemainingTime{true},
};
// Run the manager
manager.run();
......
indicators::show_console_cursor(true);
std::cout << std::endl;
// Display warning to user if any invalid/unsupported directory entries were
// found while copying
if (manager.getInvalidEntries() > 0)
{
std::cout << BOLD << YELLOW << "WARNING: " << ENDC
<< manager.getInvalidEntries() << " unsupported directory "
<< "entries (symlinks, FIFOs, etc.) were NOT copied.\n"
<< std::endl;
}
return rc;
}

Also available in: Unified diff