diff --git a/README.md b/README.md index cc70838..81d31e1 100644 --- a/README.md +++ b/README.md @@ -292,6 +292,7 @@ To see all the available options run `flight_sql --help`. flight_sql --help Allowed options: --help produce this help message + --version Print the version and exit -B [ --backend ] arg (=duckdb) Specify the database backend. Allowed options: duckdb, sqlite. -H [ --hostname ] arg Specify the hostname to listen on for the diff --git a/src/flight_sql.cpp b/src/flight_sql.cpp index 79b2760..2a86f2a 100644 --- a/src/flight_sql.cpp +++ b/src/flight_sql.cpp @@ -12,6 +12,7 @@ int main(int argc, char **argv) { po::options_description desc("Allowed options"); desc.add_options() ("help", "produce this help message") + ("version", "Print the version and exit") ("backend,B", po::value()->default_value("duckdb"), "Specify the database backend. Allowed options: duckdb, sqlite.") ("hostname,H", po::value()->default_value(""), @@ -49,7 +50,12 @@ int main(int argc, char **argv) { if (vm.count("help")) { std::cout << desc << "\n"; - return 1; + return 0; + } + + if (vm.count("version")) { + std::cout << "Flight SQL Server CLI: " << FLIGHT_SQL_SERVER_VERSION << std::endl; + return 0; } std::string backend_str = vm["backend"].as(); diff --git a/src/library/flight_sql_library.cpp b/src/library/flight_sql_library.cpp index b97025e..251a187 100644 --- a/src/library/flight_sql_library.cpp +++ b/src/library/flight_sql_library.cpp @@ -120,7 +120,7 @@ arrow::Result> FlightSQ // Exit with a clean error code (0) on SIGTERM ARROW_CHECK_OK(server->SetShutdownOnSignals({SIGTERM})); - std::cout << "Apache Arrow Flight SQL server - with engine: " << db_type << " - will listen on " + std::cout << "Apache Arrow Flight SQL server version: " << FLIGHT_SQL_SERVER_VERSION << " - with engine: " << db_type << " - will listen on " << server->location().ToString() << std::endl; return server; diff --git a/src/library/include/flight_sql_library.h b/src/library/include/flight_sql_library.h index 954c800..8bcad79 100644 --- a/src/library/include/flight_sql_library.h +++ b/src/library/include/flight_sql_library.h @@ -4,6 +4,7 @@ #include // Constants +const std::string FLIGHT_SQL_SERVER_VERSION = "v1.1.19"; // For now - be sure to update this version with the git tag! TODO: automate this const std::string DEFAULT_FLIGHT_HOSTNAME = "0.0.0.0"; const std::string DEFAULT_FLIGHT_USERNAME = "flight_username"; const int DEFAULT_FLIGHT_PORT = 31337;