]> git.armaanb.net Git - gen-shell.git/commitdiff
Fix indentation and line breaks
authorArmaan Bhojwani <me@armaanb.net>
Fri, 29 Jan 2021 00:56:37 +0000 (19:56 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Fri, 29 Jan 2021 00:56:37 +0000 (19:56 -0500)
src/main.cpp

index 392ecf96bee09ed63fc363efe947889e2901754a..0c81ddfbe89e0e0a40fa88ffea85f85a293d584c 100644 (file)
@@ -8,8 +8,8 @@
 #include <string>
 
 #ifdef HAVE_READLINE
-  #include <readline/readline.h>
-  #include <readline/history.h>
+#include <readline/readline.h>
+#include <readline/history.h>
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -22,7 +22,7 @@ const std::string getResponse(const std::string & prompt) {
   };
 
   // Display prompt, get input
-  #ifdef HAVE_READLINE
+#ifdef HAVE_READLINE
   char * line_read = readline(prompt.c_str());
   if (!line_read) {
     std::cout << "\n";
@@ -35,14 +35,14 @@ const std::string getResponse(const std::string & prompt) {
     response = std::string(line_read);
     free(line_read);
   }
-  #else
+#else
   std::cout << prompt;
   std::getline(std::cin, response);
   if (std::cin.eof() == 1) {
     std::cout << "\n";
     response = "<EOF>";
   }
-  #endif
+#endif
 
   return response;
 }
@@ -55,29 +55,32 @@ int main(int argc, char** argv)
   // Command line arguments
   Sarge sarge;
 
-       sarge.setArgument("a", "after", "Command to execute before leaving the shell", true);
-  sarge.setArgument("b", "before", "Command to execute before entering the shell", true);
+  sarge.setArgument("a", "after",
+      "Command to execute before leaving the shell", true);
+  sarge.setArgument("b", "before",
+      "Command to execute before entering the shell", true);
   sarge.setArgument("c", "command", "Command to convert to shell", true);
   sarge.setArgument("h", "help", "Get help.", false);
   sarge.setArgument("p", "prompt", "Define a custom prompt", true);
-  sarge.setArgument("", "no-space", "Dont automatically add spaces after custom prompt and command", true);
+  sarge.setArgument("", "no-space",
+      "Dont automatically add spaces after custom prompt and command", true);
   sarge.setDescription("Make a shell from any executable");
   sarge.setUsage("gen-shell <options>");
 
-       if (!sarge.parseArguments(argc, argv)) {
-               std::cerr << "Couldn't parse arguments..." << std::endl;
-               return 1;
-       }
+  if (!sarge.parseArguments(argc, argv)) {
+    std::cerr << "Couldn't parse arguments..." << std::endl;
+    return 1;
+  }
 
-       if (sarge.exists("help")) {
-               sarge.printHelp();
+  if (sarge.exists("help")) {
+    sarge.printHelp();
     return 0;
-       }
+  }
 
   bool space = true;
   if (sarge.exists("no-space")) {
     space = false;
-       }
+  }
 
   // Define input command
   string arg_cmd;