Engine 0.0.6
Game engine in lua
Loading...
Searching...
No Matches
info.lua
Go to the documentation of this file.
1local help_message = "Available commands:\n"
2 .."- init: Initializes a new game project. Requires a game path.\n"
3 .."- build: Builds the game for distribution. Defaults to the 'ginga' core.\n"
4 .."- run: Executes the specified game. Defaults to the 'love' core.\n"
5 .."- meta: Displays metadata for the specified game.\n"
6 .."- bundler: Builds the game using the specified bundler file.\n"
7 .."- compiler: Compiles the specified file into an executable.\n"
8 .."- tool-love-zip: Creates a zip file for the specified path.\n"
9 .."- tool-love-exe: Creates an executable for the specified file.\n"
10 .."- fs-replace: Replaces content in a file with specified format and replacement.\n"
11 .."- fs-download: Downloads a file from the specified URL to the specified directory.\n"
12 .."- cli-build: Bootstrap the CLI as a single file\n"
13 .."- cli-test: Runs tests with optional coverage.\n"
14 .."- cli-dump: Extract source code (when bootstrapped).\n"
15 .."- version: Displays the current version of the tool.\n"
16 .."- help: Displays this help message.\n"
17 .."\n"
18 .."Available cores:\n"
19 .."- repl: Runs the REPL core.\n"
20 .."- love: Runs the Love2D core.\n"
21 .."- ginga: Runs the Ginga core.\n"
22 .."- html5_webos: Builds for HTML5 on WebOS.\n"
23 .."- html5_tizen: Builds for HTML5 on Tizen.\n"
24 .."- html5_ginga: Runs the Ginga core for HTML5.\n"
25 .."- html5: Runs the standard HTML5 core.\n"
26 .."- nintendo_wii: Builds for the Nintendo Wii.\n"
27 .."\n"
28 .."Usage:\n"
29 .."- To run a command, use: ./cli.sh <command> <game_path> [options]\n"
30 .."- Example: ./cli.sh build ./examples/asteroids/game.lua " .. "-" .. "-core ginga\n"
31 .."\n"
32 .."Available options:\n"
33 .."-" .. "-dist <path>: Specifies the distribution directory (default: './dist/').\n"
34 .."-" .. "-core <core_name>: Specifies the core to use (default varies by command).\n"
35 .."-" .. "-screen <resolution>: Specifies the screen resolution (default: '1280x720').\n"
36 .."-" .. "-bundler: Indicates to use the bundler during the build process.\n"
37 .."-" .. "-run: Indicates to run the game after building.\n"
38 .."-" .. "-format <format>: Specifies the format for metadata display.\n"
39 .."-" .. "-coverage: Enables coverage reporting for tests.\n"
40 .."\n"
41 .."Examples:\n"
42 .."- To initialize a new game: ./cli.sh init ./my_game\n"
43 .."- To build a game: ./cli.sh build ./examples/asteroids/game.lua " .. "-" .. "-core html5\n"
44 .."- To run a game: ./cli.sh run ./examples/asteroids/game.lua " .. "-" .. "-core repl\n"
45 .."- To display metadata: ./cli.sh meta ./examples/asteroids/game.lua\n"
46
47local version_message = '0.0.6'
48
49local function help()
50 return true, help_message
51end
52
53local function version()
54 return true, version_message
55end
56
57--! @todo show all commands with complete flags
58local function show(args)
59 return false, 'not implemented!'
60end
61
62local function meta()
63 local description = 'not implemented!'
64 return {
65 meta={
66 title='gly-cli',
68 author='RodrigoDornelles',
69 description=description
70 },
71 callbacks={
72 init=function() end,
73 loop=function() end,
74 draw=function() end,
75 exit=function() end,
76 }
77 }
78end
79
80local function not_found(args)
81 return false, 'command not found: '..args['command']
82end
83
84local function correct_usage(args)
85 local index = 1
86 local lua = args[0] or 'gly-cli'
87 local command = 'usage: '..lua..' '..args.command
88
89 while index <= #args.params do
90 local param = args.params[index]
91 command = command..' ['..param..']'
92 index = index + 1
93 end
94
95 index = 1
96 while index <= #args.option_get do
97 local option = args.option_get[index]
98 command = command..' --'..option..' ['..option..']'
99 index = index + 1
100 end
101
102 index = 1
103 while index <= #args.option_has do
104 local option = args.option_has[index]
105 command = command..' --'..option
106 index = index + 1
107 end
108
109 return false, command
110end
111
112local P = {
113 meta = meta,
114 help = help,
116 ['not-found'] = not_found,
117 ['correct-usage'] = correct_usage
118}
119
120return P
local function help()
local function version()
local help_message
Definition info.lua:1
local function meta()
local function show(args)
local function not_found(args)
local version_message
Definition info.lua:3
local function correct_usage(args)
local function exit(self)
local function param(self, name, value)
local function draw(std, game)
local function init(args)
local command
Definition main.lua:12
local function loop(std, game, application, dt)