Fix flag parsing and update usage message
Summary: csv_to_snapshot: Don't skip flags when parsing csv_to_snapshot: Update usage message Reviewers: buda, mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D865
This commit is contained in:
parent
69f178b347
commit
f6a8d0e910
@ -13,6 +13,14 @@ add_executable(csv_to_snapshot
|
||||
${memgraph_src_dir}/transactions/transaction.cpp
|
||||
)
|
||||
|
||||
# Strip the executable in release build.
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type)
|
||||
if (lower_build_type STREQUAL "release")
|
||||
add_custom_command(TARGET csv_to_snapshot POST_BUILD
|
||||
COMMAND strip -s csv_to_snapshot
|
||||
COMMENT Stripping symbols and sections from csv_to_snapshot)
|
||||
endif()
|
||||
|
||||
target_link_libraries(csv_to_snapshot stdc++fs Threads::Threads fmt
|
||||
gflags glog cppitertools)
|
||||
install(TARGETS csv_to_snapshot
|
||||
|
@ -38,10 +38,10 @@ DEFINE_string(relationships, "",
|
||||
|
||||
auto ParseRepeatedFlag(const std::string &flagname, int argc, char *argv[]) {
|
||||
std::vector<std::string> values;
|
||||
for (int i = 1; i < argc; i += 2) {
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string flag(argv[i]);
|
||||
if ((flag == "--" + flagname || flag == "-" + flagname) && i + 1 < argc)
|
||||
values.push_back(argv[i + 1]);
|
||||
values.push_back(argv[++i]);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@ -337,8 +337,12 @@ void Convert(const std::vector<std::string> &nodes,
|
||||
buffer.WriteSummary(node_count, relationship_count);
|
||||
}
|
||||
|
||||
static const char *usage =
|
||||
"[OPTION]... --out SNAPSHOT_FILE [--nodes=CSV_FILE]... [--edges=CSV_FILE]...\n"
|
||||
"Create a Memgraph recovery snapshot file from CSV.\n";
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
gflags::SetUsageMessage("Create a Memgraph recovery snapshot file from CSV.");
|
||||
gflags::SetUsageMessage(usage);
|
||||
auto nodes = ParseRepeatedFlag("nodes", argc, argv);
|
||||
auto relationships = ParseRepeatedFlag("relationships", argc, argv);
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
Loading…
Reference in New Issue
Block a user