From: Armaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me> Date: Wed, 9 Dec 2020 14:24:52 +0000 (-0500) Subject: move to sr.ht, minor updates X-Git-Url: https://git.armaanb.net/?p=gen-shell.git;a=commitdiff_plain;h=0bcdb9b302d6ab0090da8701cf1b0b76d1f6b03d move to sr.ht, minor updates --- diff --git a/COPYING b/COPYING deleted file mode 100644 index 3942ae9..0000000 --- a/COPYING +++ /dev/null @@ -1,23 +0,0 @@ -gen-shell - a generic shell based on taskshell - -Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez, 2020 Armaan Bhojwani - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -http://www.opensource.org/licenses/mit-license.php diff --git a/Dockerfile b/Dockerfile index 084bf67..635582b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,8 @@ FROM debian:buster-slim AS builder RUN apt-get update && apt-get install -y cmake gcc g++ git libreadline-dev make -RUN git clone --recursive --depth 1 https://codeberg.org/armaan/gen-shell.git /app WORKDIR /app -RUN cmake --configure . -RUN cmake --build . +ENTRYPOINT git clone --recursive --depth 1 https://codeberg.org/armaan/gen-shell.git /app +CMD cmake --configure . && cmake --build . FROM debian:buster-slim AS run RUN apt-get update && apt-get install -y cpp libreadline7 libncurses6 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3942ae9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +gen-shell - a generic shell based on taskshell + +Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez, 2020 Armaan Bhojwani + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +http://www.opensource.org/licenses/mit-license.php diff --git a/README.md b/README.md index 81b0be0..d411b02 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # gen-shell -![Jenkins](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fbuild.bhojwani.org%2Fjob%2Fgen-shell%2F) A simple way to turn any command into a shell with arrow key/history support (if compiled with libreadline). Forked from [taskshell](https://github.com/GothenburgBitFactory/taskshell). ## Usage diff --git a/src/main.cpp b/src/main.cpp index 6e14fe4..144d906 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,37 +1,12 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// gen-shell, the generic shell -// -// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez, -// 2020, Armaan Bhojwani -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - +// gen-shell - the generic shell +// Copyright (c) 2020, Armaan Bhojwani #include #include #include <../Sarge/src/sarge.h> -#include +#include +#include +#include #ifdef HAVE_READLINE #include @@ -41,6 +16,7 @@ //////////////////////////////////////////////////////////////////////////////// using namespace std; +using std::filesystem::exists; const std::string getResponse(const std::string & prompt) { std::string response { @@ -130,14 +106,23 @@ int main(int argc, char** argv) string after_command; sarge.getFlag("after", after_command); + string alias_file + vector alias_files = {"$XDG_CONFIG_HOME/gen-shell/aliases", + "$HOME/.config/gen-shell/aliases"}; + for(const auto &file : alias_files) + { + if (exists(file)) + { + alias_file = file; + break; + } + } + // Do the stuffs! while (true) { - // Display prompt, get input auto command = getResponse(prompt); - // Dispatch command if (command == "" || command == "exit" || command == "quit" ) - // if (command == "" || command == "exit" ) { system (after_command.c_str ()); return 0;