mirror of https://gitee.com/bigwinds/arangodb
removed linenoise option
This commit is contained in:
parent
1c8acea215
commit
13cceddbcc
|
@ -517,10 +517,6 @@ endif ()
|
||||||
|
|
||||||
add_definitions("-DTRI_LIBEV_VERSION=\"${LIBEV_VERSION}\"")
|
add_definitions("-DTRI_LIBEV_VERSION=\"${LIBEV_VERSION}\"")
|
||||||
|
|
||||||
# linenoise --------------------------------------------------------------------
|
|
||||||
set(LINENOISE_VERSION "unknown" CACHE string "LINENOISE version")
|
|
||||||
option(USE_LINENOISE "User linenoise for editing command lines and command line histories" ON)
|
|
||||||
|
|
||||||
|
|
||||||
# Boost ------------------------------------------------------------------------
|
# Boost ------------------------------------------------------------------------
|
||||||
find_package(Boost 1.48 COMPONENTS unit_test_framework)
|
find_package(Boost 1.48 COMPONENTS unit_test_framework)
|
||||||
|
|
20
configure.ac
20
configure.ac
|
@ -614,28 +614,10 @@ AC_MSG_NOTICE([-----------------------------------------------------------------
|
||||||
AC_MSG_NOTICE([CHECKING FOR CONSOLE SUPPORT])
|
AC_MSG_NOTICE([CHECKING FOR CONSOLE SUPPORT])
|
||||||
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
|
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
|
||||||
|
|
||||||
CONSOLE_CPPFLAGS=""
|
CONSOLE_CPPFLAGS="-I${srcdir}/3rdParty/linenoise-ng/include -I${srcdir}/3rdParty/linenoise-ng/src"
|
||||||
|
|
||||||
AC_ARG_ENABLE(console,
|
|
||||||
AS_HELP_STRING([--enable-console], [enable console support (default: linenoise)]),
|
|
||||||
tr_CONSOLE="$enableval",
|
|
||||||
tr_CONSOLE="linenoise"
|
|
||||||
)
|
|
||||||
|
|
||||||
if test "$tr_CONSOLE" = "dummy"; then
|
|
||||||
LIB_INFO="$LIB_INFO|CONSOLE: dummy"
|
|
||||||
elif test "$tr_CONSOLE" = "linenoise"; then
|
|
||||||
LIB_INFO="$LIB_INFO|CONSOLE: linenoise"
|
|
||||||
CONSOLE_CPPFLAGS="-I${srcdir}/3rdParty/linenoise-ng/include -I${srcdir}/3rdParty/linenoise-ng/src -DTRI_HAVE_LINENOISE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LIB_INFO="$LIB_INFO|CONSOLE_CPPFLAGS: ${CONSOLE_CPPFLAGS}"
|
|
||||||
LIB_INFO="$LIB_INFO|."
|
|
||||||
|
|
||||||
AC_SUBST(CONSOLE_CPPFLAGS)
|
AC_SUBST(CONSOLE_CPPFLAGS)
|
||||||
|
|
||||||
AM_CONDITIONAL(ENABLE_LINENOISE, test "x$tr_CONSOLE" = xlinenoise)
|
|
||||||
|
|
||||||
dnl ----------------------------------------------------------------------------
|
dnl ----------------------------------------------------------------------------
|
||||||
dnl tcmalloc
|
dnl tcmalloc
|
||||||
dnl ----------------------------------------------------------------------------
|
dnl ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -60,12 +60,6 @@
|
||||||
|
|
||||||
#undef TRI_ENABLE_FAILURE_TESTS
|
#undef TRI_ENABLE_FAILURE_TESTS
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief enable linenoise
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#define TRI_HAVE_LINENOISE @TRI_HAVE_LINENOISE@
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief enable tcmalloc
|
/// @brief enable tcmalloc
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -762,8 +762,6 @@
|
||||||
/// @brief available features
|
/// @brief available features
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define TRI_HAVE_LINENOISE 1
|
|
||||||
|
|
||||||
#define YY_NO_UNISTD_H 1
|
#define YY_NO_UNISTD_H 1
|
||||||
|
|
||||||
#define TRI_WIN32_CONSOLE 1
|
#define TRI_WIN32_CONSOLE 1
|
||||||
|
|
|
@ -148,7 +148,6 @@ add_library(
|
||||||
Rest/InitializeRest.cpp
|
Rest/InitializeRest.cpp
|
||||||
Rest/SslInterface.cpp
|
Rest/SslInterface.cpp
|
||||||
Rest/Version.cpp
|
Rest/Version.cpp
|
||||||
Utilities/DummyShell.cpp
|
|
||||||
Utilities/LineEditor.cpp
|
Utilities/LineEditor.cpp
|
||||||
Utilities/ScriptLoader.cpp
|
Utilities/ScriptLoader.cpp
|
||||||
Utilities/ShellBase.cpp
|
Utilities/ShellBase.cpp
|
||||||
|
|
|
@ -85,7 +85,6 @@ lib_libarango_a_SOURCES = \
|
||||||
lib/Rest/InitializeRest.cpp \
|
lib/Rest/InitializeRest.cpp \
|
||||||
lib/Rest/SslInterface.cpp \
|
lib/Rest/SslInterface.cpp \
|
||||||
lib/Rest/Version.cpp \
|
lib/Rest/Version.cpp \
|
||||||
lib/Utilities/DummyShell.cpp \
|
|
||||||
lib/Utilities/LineEditor.cpp \
|
lib/Utilities/LineEditor.cpp \
|
||||||
lib/Utilities/ScriptLoader.cpp \
|
lib/Utilities/ScriptLoader.cpp \
|
||||||
lib/Utilities/ShellBase.cpp \
|
lib/Utilities/ShellBase.cpp \
|
||||||
|
@ -93,16 +92,12 @@ lib_libarango_a_SOURCES = \
|
||||||
lib/Zip/unzip.cpp \
|
lib/Zip/unzip.cpp \
|
||||||
lib/Zip/zip.cpp
|
lib/Zip/zip.cpp
|
||||||
|
|
||||||
if ENABLE_LINENOISE
|
|
||||||
|
|
||||||
lib_libarango_a_SOURCES += \
|
lib_libarango_a_SOURCES += \
|
||||||
3rdParty/linenoise-ng/src/linenoise.cpp \
|
3rdParty/linenoise-ng/src/linenoise.cpp \
|
||||||
3rdParty/linenoise-ng/src/ConvertUTF.cpp \
|
3rdParty/linenoise-ng/src/ConvertUTF.cpp \
|
||||||
3rdParty/linenoise-ng/src/wcwidth.cpp \
|
3rdParty/linenoise-ng/src/wcwidth.cpp \
|
||||||
lib/Utilities/LinenoiseShell.cpp
|
lib/Utilities/LinenoiseShell.cpp
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib_libarango_a_SOURCES += \
|
lib_libarango_a_SOURCES += \
|
||||||
3rdParty/velocypack/src/AttributeTranslator.cpp \
|
3rdParty/velocypack/src/AttributeTranslator.cpp \
|
||||||
3rdParty/velocypack/src/Builder.cpp \
|
3rdParty/velocypack/src/Builder.cpp \
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// DISCLAIMER
|
|
||||||
///
|
|
||||||
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
|
||||||
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
|
||||||
///
|
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
/// you may not use this file except in compliance with the License.
|
|
||||||
/// You may obtain a copy of the License at
|
|
||||||
///
|
|
||||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
///
|
|
||||||
/// Unless required by applicable law or agreed to in writing, software
|
|
||||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
/// See the License for the specific language governing permissions and
|
|
||||||
/// limitations under the License.
|
|
||||||
///
|
|
||||||
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
|
||||||
///
|
|
||||||
/// @author Dr. Frank Celler
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "DummyShell.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
using namespace arangodb;
|
|
||||||
|
|
||||||
DummyShell::DummyShell(std::string const& history, Completer* completer)
|
|
||||||
: ShellBase(history, completer) {}
|
|
||||||
|
|
||||||
DummyShell::~DummyShell() { close(); }
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief line editor open
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool DummyShell::open(bool) {
|
|
||||||
_state = STATE_OPENED;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DummyShell::close() {
|
|
||||||
_state = STATE_CLOSED;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DummyShell::addHistory(std::string const&) {}
|
|
||||||
|
|
||||||
bool DummyShell::writeHistory() { return true; }
|
|
||||||
|
|
||||||
std::string DummyShell::getLine(std::string const& prompt, bool& eof) {
|
|
||||||
std::cout << prompt << std::flush;
|
|
||||||
|
|
||||||
std::string line;
|
|
||||||
std::getline(std::cin, line);
|
|
||||||
|
|
||||||
if (std::cin.eof()) {
|
|
||||||
eof = true;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return line;
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// DISCLAIMER
|
|
||||||
///
|
|
||||||
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
|
|
||||||
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
|
|
||||||
///
|
|
||||||
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
/// you may not use this file except in compliance with the License.
|
|
||||||
/// You may obtain a copy of the License at
|
|
||||||
///
|
|
||||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
///
|
|
||||||
/// Unless required by applicable law or agreed to in writing, software
|
|
||||||
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
/// See the License for the specific language governing permissions and
|
|
||||||
/// limitations under the License.
|
|
||||||
///
|
|
||||||
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
|
||||||
///
|
|
||||||
/// @author Esteban Lombeyda
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef LIB_UTILITIES_DUMMY_SHELL_H
|
|
||||||
#define LIB_UTILITIES_DUMMY_SHELL_H 1
|
|
||||||
|
|
||||||
#include "ShellBase.h"
|
|
||||||
|
|
||||||
namespace arangodb {
|
|
||||||
class Completer;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief DummyShell
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class DummyShell : public ShellBase {
|
|
||||||
public:
|
|
||||||
DummyShell(std::string const& history, Completer*);
|
|
||||||
|
|
||||||
virtual ~DummyShell();
|
|
||||||
|
|
||||||
public:
|
|
||||||
bool open(bool autoComplete) override final;
|
|
||||||
|
|
||||||
bool close() override final;
|
|
||||||
|
|
||||||
void addHistory(std::string const&) override final;
|
|
||||||
|
|
||||||
bool writeHistory() override final;
|
|
||||||
|
|
||||||
std::string getLine(std::string const& prompt, bool& eof) override final;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -26,11 +26,7 @@
|
||||||
#include "Basics/StringUtils.h"
|
#include "Basics/StringUtils.h"
|
||||||
#include "Basics/files.h"
|
#include "Basics/files.h"
|
||||||
#include "Utilities/Completer.h"
|
#include "Utilities/Completer.h"
|
||||||
#include "Utilities/DummyShell.h"
|
|
||||||
|
|
||||||
#if defined(TRI_HAVE_LINENOISE)
|
|
||||||
#include "Utilities/LinenoiseShell.h"
|
#include "Utilities/LinenoiseShell.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace arangodb;
|
using namespace arangodb;
|
||||||
using namespace arangodb::basics;
|
using namespace arangodb::basics;
|
||||||
|
@ -41,18 +37,7 @@ using namespace arangodb::basics;
|
||||||
|
|
||||||
ShellBase* ShellBase::buildShell(std::string const& history,
|
ShellBase* ShellBase::buildShell(std::string const& history,
|
||||||
Completer* completer) {
|
Completer* completer) {
|
||||||
// no keyboard input. use low-level shell without fancy color codes
|
|
||||||
// and with proper pipe handling
|
|
||||||
|
|
||||||
if (!isatty(STDIN_FILENO)) {
|
|
||||||
return new DummyShell(history, completer);
|
|
||||||
} else {
|
|
||||||
#if defined(TRI_HAVE_LINENOISE)
|
|
||||||
return new LinenoiseShell(history, completer);
|
return new LinenoiseShell(history, completer);
|
||||||
#else
|
|
||||||
return new DummyShell(history, completer); // last resort!
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue