You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+87Lines changed: 87 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,6 +140,93 @@ cd codegame-cli
140
140
go build .
141
141
```
142
142
143
+
## Modules
144
+
145
+
Language specific functionality is provided by modules.
146
+
*codegame-cli* automatically downloads the correct module version corresponding to the CodeGame version and
147
+
executes the downloaded binary at the root of the project directory with the respective command.
148
+
149
+
Additionally, the _CONFIG_FILE_ environment variable is set with the path to a temporary file containing command specific configuration in JSON format.
150
+
151
+
Modules can be implemented in any language. However, it is recommended to write them in Go
152
+
using the `github.com/code-game-project/codegame-cli/pkg/*` packages and the `github.com/Bananenpro/cli` package for CLI interaction in order to be consistent with the CLI and other modules.
153
+
154
+
### new
155
+
156
+
Creates a new project of the type provided by a second command line argument:
157
+
158
+
#### client
159
+
160
+
Creates a new game client.
161
+
This includes integration with the client library for the language, a functioning template with a main file and language specific metadata files like `package.json` or similar
162
+
and wrappers around the library to make its usage easier including setting the game URL with the CG_GAME_URL environment variable (required).
163
+
164
+
##### config data
165
+
166
+
```jsonc
167
+
{
168
+
"lang":"go", // the chosen programming language (in case one module supports multiple languages)
169
+
"name":"my_game", // the name of the game
170
+
"url":"my_game.example.com", // the URL of the game server
171
+
"library_version":"0.9.2"// the version of the client library to use
172
+
}
173
+
```
174
+
175
+
#### server
176
+
177
+
Creates a new game server.
178
+
This includes integration with the server library of the language and a functioning template, which implements common logic like starting the server and providing a game class.
179
+
180
+
##### config data
181
+
182
+
```jsonc
183
+
{
184
+
"lang":"go", // the chosen programming language (in case one module supports multiple languages)
185
+
"library_version":"0.9.2"// the version of the server library to use
186
+
}
187
+
```
188
+
189
+
### update
190
+
191
+
Updates the library to the specified version and all other dependencies used by the project to their newest compatible version.
192
+
Additionally all wrappers are updated.
193
+
194
+
##### config data
195
+
196
+
```jsonc
197
+
{
198
+
"lang":"go", // the chosen programming language (in case one module supports multiple languages)
199
+
"library_version":"0.9.2"// the new version of the library to use
200
+
}
201
+
202
+
```
203
+
204
+
### run
205
+
206
+
Runs the project with the specified command line arguments.
207
+
208
+
##### config data
209
+
210
+
```jsonc
211
+
{
212
+
"lang":"go", // the chosen programming language (in case one module supports multiple languages)
213
+
"args": ["-f", "my_file.txt"] // the command line arguments for the application
214
+
}
215
+
```
216
+
217
+
### build
218
+
219
+
Builds the projects and injects the URL specified in the `.codegame.json` file, which makes the *CG_GAME_URL* environment variable optional.
220
+
221
+
##### config data
222
+
223
+
```jsonc
224
+
{
225
+
"lang":"go", // the chosen programming language (in case one module supports multiple languages)
226
+
"output":"bin/my-game"// The name of the output file
0 commit comments