diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e5e769b7d..cf01288686 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -519,10 +519,6 @@ endif () 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 ------------------------------------------------------------------------ find_package(Boost 1.48 COMPONENTS unit_test_framework) diff --git a/configure.ac b/configure.ac index ce52949262..a3df43e807 100644 --- a/configure.ac +++ b/configure.ac @@ -614,28 +614,10 @@ AC_MSG_NOTICE([----------------------------------------------------------------- AC_MSG_NOTICE([CHECKING FOR CONSOLE SUPPORT]) AC_MSG_NOTICE([--------------------------------------------------------------------------------]) -CONSOLE_CPPFLAGS="" - -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|." +CONSOLE_CPPFLAGS="-I${srcdir}/3rdParty/linenoise-ng/include -I${srcdir}/3rdParty/linenoise-ng/src" AC_SUBST(CONSOLE_CPPFLAGS) -AM_CONDITIONAL(ENABLE_LINENOISE, test "x$tr_CONSOLE" = xlinenoise) - dnl ---------------------------------------------------------------------------- dnl tcmalloc dnl ---------------------------------------------------------------------------- diff --git a/lib/Basics/local-configuration.h.in b/lib/Basics/local-configuration.h.in index 910072bde6..aba4afa3a2 100644 --- a/lib/Basics/local-configuration.h.in +++ b/lib/Basics/local-configuration.h.in @@ -60,12 +60,6 @@ #undef TRI_ENABLE_FAILURE_TESTS -//////////////////////////////////////////////////////////////////////////////// -/// @brief enable linenoise -//////////////////////////////////////////////////////////////////////////////// - -#define TRI_HAVE_LINENOISE @TRI_HAVE_LINENOISE@ - //////////////////////////////////////////////////////////////////////////////// /// @brief enable tcmalloc //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/Basics/operating-system.h b/lib/Basics/operating-system.h index 4bf95ed3ae..94d22dea54 100644 --- a/lib/Basics/operating-system.h +++ b/lib/Basics/operating-system.h @@ -762,8 +762,6 @@ /// @brief available features //////////////////////////////////////////////////////////////////////////////// -#define TRI_HAVE_LINENOISE 1 - #define YY_NO_UNISTD_H 1 #define TRI_WIN32_CONSOLE 1 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index de62167288..752525b8c6 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -148,7 +148,6 @@ add_library( Rest/InitializeRest.cpp Rest/SslInterface.cpp Rest/Version.cpp - Utilities/DummyShell.cpp Utilities/LineEditor.cpp Utilities/ScriptLoader.cpp Utilities/ShellBase.cpp diff --git a/lib/Makefile.files b/lib/Makefile.files index 85fe8bd6d0..311739c070 100644 --- a/lib/Makefile.files +++ b/lib/Makefile.files @@ -85,7 +85,6 @@ lib_libarango_a_SOURCES = \ lib/Rest/InitializeRest.cpp \ lib/Rest/SslInterface.cpp \ lib/Rest/Version.cpp \ - lib/Utilities/DummyShell.cpp \ lib/Utilities/LineEditor.cpp \ lib/Utilities/ScriptLoader.cpp \ lib/Utilities/ShellBase.cpp \ @@ -93,16 +92,12 @@ lib_libarango_a_SOURCES = \ lib/Zip/unzip.cpp \ lib/Zip/zip.cpp -if ENABLE_LINENOISE - lib_libarango_a_SOURCES += \ 3rdParty/linenoise-ng/src/linenoise.cpp \ 3rdParty/linenoise-ng/src/ConvertUTF.cpp \ 3rdParty/linenoise-ng/src/wcwidth.cpp \ lib/Utilities/LinenoiseShell.cpp -endif - lib_libarango_a_SOURCES += \ 3rdParty/velocypack/src/AttributeTranslator.cpp \ 3rdParty/velocypack/src/Builder.cpp \ diff --git a/lib/Utilities/DummyShell.cpp b/lib/Utilities/DummyShell.cpp deleted file mode 100644 index 0b6086bb77..0000000000 --- a/lib/Utilities/DummyShell.cpp +++ /dev/null @@ -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 - -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; -} diff --git a/lib/Utilities/DummyShell.h b/lib/Utilities/DummyShell.h deleted file mode 100644 index d2dd87b7e5..0000000000 --- a/lib/Utilities/DummyShell.h +++ /dev/null @@ -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 diff --git a/lib/Utilities/ShellBase.cpp b/lib/Utilities/ShellBase.cpp index 67fda9f627..6368e396de 100644 --- a/lib/Utilities/ShellBase.cpp +++ b/lib/Utilities/ShellBase.cpp @@ -26,11 +26,7 @@ #include "Basics/StringUtils.h" #include "Basics/files.h" #include "Utilities/Completer.h" -#include "Utilities/DummyShell.h" - -#if defined(TRI_HAVE_LINENOISE) #include "Utilities/LinenoiseShell.h" -#endif using namespace arangodb; using namespace arangodb::basics; @@ -41,18 +37,7 @@ using namespace arangodb::basics; ShellBase* ShellBase::buildShell(std::string const& history, 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); -#else - return new DummyShell(history, completer); // last resort! -#endif - } + return new LinenoiseShell(history, completer); } ////////////////////////////////////////////////////////////////////////////////