Added documentation for CeeV.

master
Ruben Dahl 2023-01-15 19:40:48 +01:00
parent bed4a4919b
commit 74b0a1311e
No known key found for this signature in database
GPG Key ID: C7838D0300EDEF1B
4 changed files with 244 additions and 2 deletions

@ -1 +1 @@
Subproject commit 9745e4d63a0579f859247e3395fb33af8eafe2eb Subproject commit ccc88d088865952b488eb3282531a48e8e5aae4a

239
src/README.md 100644
View File

@ -0,0 +1,239 @@
# CeeV Documentation
## Includes
```cpp
#include <SDL2/SDL.h>
#include <algorithm>
#include <ceev/colors.h>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <sstream>
```
## Statics
```cpp
#define __ceev_version
```
The current version of CeeV
```cpp
#define CONFIG_FILENAME
```
The filename used in `ceev init`
```cpp
#define GIT_COMMIT_HASH
```
The latest git commit hash, defined by cmake.
```cpp
#define GIT_COMMIT_MSG
```
The latest git commit message, defined by cmake.
```cpp
#define GIT_COMMIT_DATE
```
The latest git commit date, defined by cmake.
```cpp
#define GIT_COMMIT_AUTHOR
```
The author of the latest git commit, defined by cmake.
```cpp
#define GET_PROGRAM_NAME()
```
The program invocation name.
```cpp
#define INPROG
```
Shorthand for marking item as in progress in devel_roadmap()
```cpp
#define TODO b
```
Shorthand for marking item as todo in devel_roadmap()
```cpp
#define HALTED
```
Shorthand for marking item as halted in devel_roadmap()
```cpp
#define STATUS
```
Shorthand for the status in devel_roadmap()
## Structures
```cpp
struct config_data {
std::string name = "";
std::string version = "";
std::string author = "";
std::string email = "";
};
```
The struct for the configuration
## Functions
```cpp
static int usage();
```
Returns: int exit_code - Always 1
Shows the usage of the program.
```cpp
static int show_help();
```
Returns: int exit_code - Always 0
Shows the help for the program when the user runs `ceev -h`.
```cpp
static int buildinfo();
```
Returns: int exit_code - Always 0
Shows the build information when the user runs `ceev -B`.
```cpp
bool replace(std::string& str, const std::string& from, const std::string& to);
```
Param: std::string& str - The input string to be modifyed
Param: const std::string& from - What to replace
Param: const std::string& to - What to replace with
Returns: bool success - Whether it was successful or not.
Replaces `from` with `to` within the string.
```cpp
static std::string query_author();
```
Returns: The string input in the function
Queries the user for a string to be used as the project author.
```cpp
struct config_data get_config(bool ignore_err = false)
```
Param: int ignore_err - Normally false
Returns: struct config_data
Reads the config file and builds the config_data struct. Returns an empty struct
if it cannot open the file. ignore_err suppresses the error message, used for
`ceev devel sdl2 --use-defaults`.
```cpp
int create_fs(std::deque<std::string> args);
```
Param: std::deque\<std::string\> args - The arguments from main(), with used
values stripped out.
Returns: int exit_code
Creates the default file system.
```cpp
int build_project(std::deque<std::string> args);
```
Param: std::deque\<std::string\> args - The arguments from main(), with used
values stripped out.
Returns: int exit_code
Not yet implemented.
```cpp
int run_project(std::deque<std::string> args);
```
Param: std::deque\<std::string\> args - The arguments from main(), with used
values stripped out.
Returns: int exit_code
Not properly implemented yet, but prints out the config data and runs the SDL2
demo.
```cpp
int clean_project(std::deque<std::string> args);
```
Param: std::deque\<std::string\> args - The arguments from main(), with used
values stripped out.
Returns: int exit_code
Not yet implemented
```cpp
int devel(std::deque<std::string> args);
```
Param: std::deque\<std::string\> args - The arguments from main(), with used
values stripped out.
Returns: int exit_code
The subcommand `ceev devel`. Parses the inputs and runs supplementary functions.
```cpp
int devel_help();
```
Returns: int exit_code
Shows the help page for `ceev devel`.
```cpp
int devel_roadmap();
```
Returns: int exit_code
Shows the current roadmap.
```cpp
int devel_sdl2(std::deque<std::string> args);
```
Param: std::deque\<std::string\> args - The arguments from main(), with used
values stripped out.
Returns: int exit_code
Runs a small demo with SDL2. Running with the `--use-defaults` flag doesn't
require you to use a config file.
```cpp
int devel_lang(std::deque<std::string> args);
```
Param: std::deque\<std::string\> args - The arguments from main(), with used
values stripped out.
Returns: int exit_code
Not yet implemented
```cpp
int main(int argc, char **argv);
```
Param: int argc - The number of arguments
Param: char \*\*argv - An array of the arguments
Returns: int exit_code
The entrypoint. Parses the arguments and puts them into a deque. It then runs
the other functions based on what has been input in the arguments.

View File

@ -184,6 +184,7 @@ int create_fs(std::deque<std::string> args) {
} }
int build_project(std::deque<std::string> args) { int build_project(std::deque<std::string> args) {
std::cout << TODO << ": Function is not made yet.\n";
std::cout << "Building project..." << std::endl; std::cout << "Building project..." << std::endl;
return 0; return 0;
} }
@ -199,6 +200,7 @@ int run_project(std::deque<std::string> args) {
} }
int clean_project(std::deque<std::string> args) { int clean_project(std::deque<std::string> args) {
std::cout << TODO << ": Function is not made yet.\n";
std::cout << "Cleaning project..." << std::endl; std::cout << "Cleaning project..." << std::endl;
return 0; return 0;
} }
@ -327,7 +329,7 @@ int devel_sdl2(std::deque<std::string> args) {
} }
int devel_lang(std::deque<std::string> args) { int devel_lang(std::deque<std::string> args) {
std::cerr << "Not implemented yet" << std::endl; std::cout << TODO << ": Function is not made yet.\n";
return 1; return 1;
} }

View File

@ -60,6 +60,7 @@ static int show_help();
static int buildinfo(); static int buildinfo();
bool replace(std::string& str, const std::string& from, const std::string& to); bool replace(std::string& str, const std::string& from, const std::string& to);
static std::string query_author(); static std::string query_author();
struct config_data get_config(bool ignore_err);
int create_fs(std::deque<std::string> args); int create_fs(std::deque<std::string> args);
int build_project(std::deque<std::string> args); int build_project(std::deque<std::string> args);
int run_project(std::deque<std::string> args); int run_project(std::deque<std::string> args);