-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from olokreaz/LOF-1
add --help option
- Loading branch information
Showing
2 changed files
with
140 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,122 @@ | ||
# Compile Time generator of configs | ||
--- | ||
GCT - это генератор CT конфига, тоесть из простого конфига, сгенерируется config.h / config.hpp файл, в котором будет все сгенерированые | ||
--- | ||
# CTH++ | ||
|
||
## Introduction | ||
|
||
### What is CTH++ | ||
|
||
## Usage | ||
|
||
```text | ||
Usage: cth++ [options] | ||
Options: | ||
-h, --help - show this message | ||
-f, --file=<file> - input json file | ||
-o, --output=<file> - output file | ||
-w, --working=<dir> - working directory | ||
--std <std> - c++ standard | ||
--cmake-target-current-build <target> - current build target | ||
--global-namespace <name> - global namespace | ||
--debug - debug mode | ||
--release - release mode | ||
--development - development mode | ||
--production - production mode | ||
``` | ||
|
||
# Example | ||
|
||
```shell | ||
$ cth++ -f=config.json -o=config.h | ||
``` | ||
|
||
- config.json | ||
|
||
```json | ||
|
||
#### Usage: | ||
```hjson | ||
{ | ||
project: { | ||
name: my_project | ||
version: 1.0.0 | ||
type: debug|developing | ||
} | ||
config: { | ||
server: { | ||
log: { | ||
level: { | ||
debug: TRACE | ||
release: WARN | ||
} | ||
} | ||
} | ||
} | ||
"project": { | ||
"name": "Example", | ||
"desc": "Example Example Example ", | ||
"version": "1.1.1", | ||
"debug": true, | ||
"dev": true, | ||
"output-path": "path/to/output", | ||
"project-dir": "path/to/project/dir" | ||
}, | ||
"config": { | ||
"client": { | ||
"port": 52485, | ||
"host": "localhost" | ||
}, | ||
"server": { | ||
"port": 2000, | ||
"host": "localhost", | ||
"options": { | ||
"max-connections": 10, | ||
"offline": false, | ||
"debug": { | ||
"max-connections": 5 | ||
} | ||
} | ||
}, | ||
"master": { | ||
"port": 2000, | ||
"host": "localhost" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
```cpp | ||
... | ||
namespace my_project{ | ||
namespace project{ | ||
constexpr char* name = u8"my_project"; | ||
constexpr char* version = u8"1.0.0"; | ||
constexpr bool debug = true; | ||
constexpr bool developing = true; | ||
constepxr bool release = false; | ||
constexpr bool production = false; | ||
} | ||
namespacee config { | ||
- config.hpp | ||
|
||
```c++ | ||
// path/to/output | ||
/* | ||
_____ _ | ||
| ____| __ __ __ _ _ __ ___ _ __ | | ___ | ||
| _| \ \/ / / _` | | '_ ` _ \ | '_ \ | | / _ \ | ||
| |___ > < | (_| | | | | | | | | |_) | | | | __/ | ||
|_____| /_/\_\ \__,_| |_| |_| |_| | .__/ |_| \___| | ||
|_| | ||
*/ | ||
|
||
#pragma once | ||
|
||
#define VERSION_PACK(MAJOR, MINOR, PATCH) \ | ||
( ( ( MAJOR ) << 16 ) | ( ( MINOR ) << 8 ) | ( PATCH ) ) | ||
|
||
|
||
namespace config { | ||
namespace project { | ||
constexpr char *name = "Example"; | ||
constexpr char *description = "Example work with config"; | ||
constexpr char *git_hash = "fb3483f"; | ||
constexpr unsigned int version = 65536; | ||
constexpr bool debug = true; | ||
constexpr bool release = false; | ||
constexpr bool development = true; | ||
constexpr bool production = false; | ||
constexpr char *target = ""; | ||
constexpr char *mode = "development"; | ||
constexpr char *type = "debug"; | ||
} | ||
namespace client { | ||
constexpr char *host = "localhost"; | ||
constexpr unsigned long long port = 52485ULL; | ||
} | ||
namespace master { | ||
constexpr char *host = "localhost"; | ||
constexpr unsigned long long port = 2000ULL; | ||
} | ||
namespace server { | ||
namespacec log { | ||
constexpr char* level = u8"TRACE"; | ||
} | ||
constexpr char *host = "localhost"; | ||
namespace options { | ||
namespace debug { | ||
constexpr unsigned long long max_connections = 5ULL; | ||
} | ||
constexpr unsigned long long max_connections = 10ULL; | ||
constexpr bool offline = false; | ||
} | ||
constexpr unsigned long long port = 2000ULL; | ||
} | ||
} | ||
} | ||
... | ||
``` | ||
|
||
|
||
### reference | ||
- buildroot config(make nconfig) | ||
- linux dialog | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters