fix(server): better support for the --help option (#349)
Co-authored-by: Boaz Sade <boaz@dragonflydb.io>
This commit is contained in:
parent
d2b216077d
commit
a1b800e23b
|
@ -4,7 +4,7 @@ cxx_link(dragonfly base dragonfly_lib)
|
||||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_BUILD_TYPE STREQUAL "Release")
|
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
# Add core2 only to this file, thus avoiding instructions in this object file that
|
# Add core2 only to this file, thus avoiding instructions in this object file that
|
||||||
# can cause SIGILL.
|
# can cause SIGILL.
|
||||||
set_source_files_properties(dfly_main.cc PROPERTIES COMPILE_FLAGS -march=core2)
|
set_source_files_properties(dfly_main.cc PROPERTIES COMPILE_FLAGS -march=core2 COMPILE_DEFINITIONS SOURCE_PATH_FROM_BUILD_ENV=${CMAKE_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(dfly_transaction db_slice.cc engine_shard_set.cc blocking_controller.cc common.cc
|
add_library(dfly_transaction db_slice.cc engine_shard_set.cc blocking_controller.cc common.cc
|
||||||
|
|
|
@ -29,6 +29,13 @@
|
||||||
#include "util/uring/uring_pool.h"
|
#include "util/uring/uring_pool.h"
|
||||||
#include "util/varz.h"
|
#include "util/varz.h"
|
||||||
|
|
||||||
|
#define STRING_PP_NX(A) #A
|
||||||
|
#define STRING_MAKE_PP(A) STRING_PP_NX(A)
|
||||||
|
|
||||||
|
// This would create a string value from a "defined" location of the source code
|
||||||
|
// Note that SOURCE_PATH_FROM_BUILD_ENV is taken from the build system
|
||||||
|
#define BUILD_LOCATION_PATH STRING_MAKE_PP(SOURCE_PATH_FROM_BUILD_ENV)
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ABSL_DECLARE_FLAG(uint32_t, port);
|
ABSL_DECLARE_FLAG(uint32_t, port);
|
||||||
|
@ -92,10 +99,14 @@ bool HelpFlags(std::string_view f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
string NormalizePaths(std::string_view path) {
|
string NormalizePaths(std::string_view path) {
|
||||||
if (absl::ConsumePrefix(&path, "../src/"))
|
const std::string FULL_PATH = BUILD_LOCATION_PATH;
|
||||||
|
const std::string FULL_PATH_SRC = FULL_PATH + "/src";
|
||||||
|
const std::string FULL_PATH_HELIO = FULL_PATH + "/helio";
|
||||||
|
|
||||||
|
if (absl::ConsumePrefix(&path, "../src/") || absl::ConsumePrefix(&path, FULL_PATH_SRC))
|
||||||
return ColoredStr(TermColor::kGreen, path);
|
return ColoredStr(TermColor::kGreen, path);
|
||||||
|
|
||||||
if (absl::ConsumePrefix(&path, "../"))
|
if (absl::ConsumePrefix(&path, "../") || absl::ConsumePrefix(&path, FULL_PATH_HELIO))
|
||||||
return ColoredStr(TermColor::kYellow, path);
|
return ColoredStr(TermColor::kYellow, path);
|
||||||
|
|
||||||
if (absl::ConsumePrefix(&path, "_deps/"))
|
if (absl::ConsumePrefix(&path, "_deps/"))
|
||||||
|
|
Loading…
Reference in New Issue