|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #include <map>
- #include <string>
- #include <vector>
- #include "cli.h"
- #include "cli_Context.h"
- #include "memory.h"
- #include "memory_Context.h"
- #include "shell.h"
-
- // Greet the user upon start
-
- shell_Context shell_launch(
- shell_Context c
- ) {
- c.cCLI = cli_greetUser(c.cCLI);
- c.cCLI.input = "help";
- c.cCLI = cli_showHelp(c.cCLI);
- c.output = c.cCLI.outputGreeting + "\n" + c.cCLI.outputHelp;
- return c;
- }
-
- // Switch among CLI functions based on input
- //
- // Conditions:
- // 1. User requested to quit the game
- // 2. User plays the game
-
-
-
- shell_Context shell_processInput(
- shell_Context c
- ) {
- if (
- c.input == "e" ||
- c.input == "exit" ||
- c.input == "q" ||
- c.input == "quit"
- ) {
- c.exit = true;
- return c;
- }
- c.cCLI.input = c.input;
- c.output = "";
- c.cCLI = cli_showHelp(c.cCLI);
- if (
- c.cCLI.recentField == "outputHelp"
- ) {
- c.output += c.cCLI.outputHelp;
- }
- return c;
- }
-
|