+ // 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("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.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.exists("help")) {
+ sarge.printHelp();
+ return 0;
+ }
+
+ bool space = true;
+ if (sarge.exists("no-space")) {
+ space = false;
+ }
+
+ // Define input command
+ string arg_cmd;
+ sarge.getFlag("command", arg_cmd);
+ if ( space )
+ arg_cmd += " ";
+
+ // Define prompt
+ string prompt = "";
+ sarge.getFlag("prompt", prompt);
+ if ( prompt == "" )