5 The CLIs Flow
Craig Oates edited this page 4 years ago

To help you get up to speed on how WetPancakeCLI works, please consider the following image:

wetpancakecli flow

The way it works is:

  1. The console receives input from the end-user;
  2. It then parses the input and matches it with a "command-method". (The command-methods live in "ConsoleCommands.cs".); After that,
  3. The command-method then runs and returns its result.

That's the simple version at least.

The reason the program runs this way is because I built it with Console.Waterworks (C.W.). If you would like to know about C.W., I recommend you use the following links:

Because this wiki is not about learning the intricacies of how C.W. works, I will provide a basic overview of what it is. If you find yourself still needing more information, please use the links above. They go into a lot more detail and you can also inspect C.W's code if you want. If you want to work with the source code in this project, you do need a basic understanding of how C.W. works. Without it, you will find it difficult and some design decisions might seem odd. At a basic level,C.W. is a NuGet package which helps you write console programs. From a distance, C.W. programs look a bit like an M.V.C. program. To help explain, here is an illustration of C.W's basic structure/flow:

console.waterworks flow

For C.W. to operate the way it does,it needs to rely on certain things, which are:

  1. C.W. controls the "input-loop" from main.
  2. There ConsoleCommands class must live in a name-space within the project.
  3. The "command-methods" within ConsoleCommands are marked as public and static.

If you are new to the project, I recommend you take a moment looking at the code in "Program.cs"; Do this alongside looking at the code in "ConsoleCommands.cs". Once you have a good grasp of what is happening in "Program.cs", you should not need to look at it again. That is when you can start to focus on the code in "ConsoleCommands.cs" -- the place you where most of the work is.