From: Armaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me> Date: Fri, 30 Oct 2020 15:47:46 +0000 (-0400) Subject: further reduction X-Git-Url: https://git.armaanb.net/?p=gen-shell.git;a=commitdiff_plain;h=f5b6ded9977a1df7f102c65666c9b0a89d7a4a6c further reduction --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 40a3ead..31151de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,19 +9,6 @@ include (CheckFunctionExists) include (CheckStructHasMember) include (CheckCXXCompilerFlag) -message ("-- Looking for SHA1 references") -if (EXISTS ${CMAKE_SOURCE_DIR}/.git/index) - set (HAVE_COMMIT true) - execute_process (COMMAND git log -1 --pretty=format:%h - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE COMMIT) - message ("-- Found SHA1 reference: ${COMMIT}") -endif (EXISTS ${CMAKE_SOURCE_DIR}/.git/index) - -set (PACKAGE "${PROJECT_NAME}") -set (PACKAGE_NAME "${PACKAGE}") -set (PACKAGE_TARNAME "${PACKAGE}") - # include the readline library finder module set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules") diff --git a/README.md b/README.md index 11f0511..c1f9fc8 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,13 @@ Binaries can be downloaded [from here](https://build.bhojwani.org/job/gen-shell/ ### From source If you would like to avoid this, you can build from source. Doing so requires: - - cmake + - cmake (2.8 or higher) - make - gcc - g++ (sometimes packaged as gcc-c++ or gcc-g++) - - cpp 11 or higher - - libreadline development files (7 or 8 is fine) -``` + - cpp (11 or higher) + - libreadline development files (7 or 8 is fine, 5 is untested) +```bash git clone https://codeberg.org/armaan/gen-shell cd gen-shell cmake . @@ -30,6 +30,15 @@ Or if you don't have root access, you can subsitute the last line with ### Docker You can also run gen-shell in docker. Simply use +```bash +docker run -it -e CMD= armaanb/gen-shell:latest ``` -docker run -it -e CMD= armaanb/gen-shell:latest +Or to build the docker container locally +```bash +git clone https://codeberg.org/armaan/gen-shell +cd gen-shell +docker build -t armaanb/gen-shell:latest . +docker run -it -e CMD= armaanb/gen-shell ``` +## License +Following suit from tasksh, gen-shell is MIT licensed by Armaan Bhojwani, 2020. Gen-shell is forked from tasksh, from which its codebase has been greatly reduced, although the majority of code remaining was written by the tasksh developers [(listed here)](https://github.com/GothenburgBitFactory/taskshell/blob/master/AUTHORS). diff --git a/cmake.h b/cmake.h index bce1188..ac1bb92 100644 --- a/cmake.h +++ b/cmake.h @@ -19,7 +19,7 @@ #define LANGUAGE_ENG_USA /* git information */ -#define HAVE_COMMIT +/* #undef HAVE_COMMIT */ /* cmake information */ #define HAVE_CMAKE diff --git a/src/main.cpp b/src/main.cpp index b334ce7..703f46a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,12 +26,7 @@ #include #include -#include -#include -#include -#include #include -#include #ifdef HAVE_READLINE #include diff --git a/src/prompt.cpp b/src/prompt.cpp index 93654d4..5b2e048 100644 --- a/src/prompt.cpp +++ b/src/prompt.cpp @@ -28,16 +28,6 @@ #include #include -static std::vector contextColors = { - "bold white on red", - "bold white on blue", - "bold white on green", - "bold white on magenta", - "black on cyan", - "black on yellow", - "black on white", -}; - static std::vector contexts; std::string composeContexts (bool pretty = false); @@ -65,24 +55,6 @@ int promptAdd (const std::string& context) return 0; } -//////////////////////////////////////////////////////////////////////////////// -std::string composeContexts (bool pretty /* = false */) -{ - std::string combined; - for (unsigned int i = 0; i < contexts.size (); i++) - if (pretty) - combined += (combined != "" ? " " : "") - + std::string ("\001") - + "\002"; - else - combined += (combined != "" ? " " : "") + contexts[i]; - - if (combined != "") - combined += ' '; - - return combined; -} - //////////////////////////////////////////////////////////////////////////////// std::string promptCompose () {