2016-01-27 06:40:11 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "utils/command_line/arguments.hpp"
|
2016-02-08 05:56:52 +08:00
|
|
|
#include "utils/string/file.hpp"
|
2016-01-27 06:40:11 +08:00
|
|
|
|
|
|
|
std::string extract_query(const vector_str& arguments)
|
|
|
|
{
|
|
|
|
if (contain_argument(arguments, "-q"))
|
|
|
|
return get_argument(arguments, "-q", "CREATE (n) RETURN n");
|
|
|
|
auto default_file = "query.cypher";
|
|
|
|
auto file = get_argument(arguments, "-f", default_file);
|
|
|
|
// TODO: error handling
|
2016-02-08 05:56:52 +08:00
|
|
|
return utils::read_file(file.c_str());
|
2016-01-27 06:40:11 +08:00
|
|
|
}
|
|
|
|
|