]> git.armaanb.net Git - gen-shell.git/commitdiff
move to sr.ht, minor updates
authorArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Wed, 9 Dec 2020 14:24:52 +0000 (09:24 -0500)
committerArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Wed, 9 Dec 2020 14:24:52 +0000 (09:24 -0500)
COPYING [deleted file]
Dockerfile
LICENSE [new file with mode: 0644]
README.md
src/main.cpp

diff --git a/COPYING b/COPYING
deleted file mode 100644 (file)
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
index 084bf67a256473f33a7dd19f69e50493c07ffd97..635582b539f53de96b34545cb4c4b202141b659a 100644 (file)
@@ -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 (file)
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
index 81b0be0453122ee0f6bb58cf7b9333abdfe846a6..d411b02253d85f1bab6b7045a8a30d108412283d 100644 (file)
--- 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
index 6e14fe4a8c4d0ecaa043e4bf7a88bdb9f46d1d78..144d9069980d49f770aa64e07896370fb3c55eb0 100644 (file)
@@ -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 <code@armaanb.net>
 
 #include <cmake.h>
 #include <iostream>
 #include <../Sarge/src/sarge.h>
-#include <stdlib.h>
+#include <filesystem>
+#include <vector>
+#include <string>
 
 #ifdef HAVE_READLINE
   #include <readline/readline.h>
@@ -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<string> 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 == "<EOF>" || command == "exit" || command == "quit" )
-    // if (command == "<EOF>" || command == "exit" )
     {
       system (after_command.c_str ());
       return 0;