From cb27c8f5a31e3e36492c687c05767144f8f6cfb0 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Thu, 28 Jan 2021 19:56:37 -0500 Subject: [PATCH] Fix indentation and line breaks --- src/main.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 392ecf9..0c81ddf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,8 +8,8 @@ #include #ifdef HAVE_READLINE - #include - #include +#include +#include #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 = ""; } - #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 "); - 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; -- 2.39.2