aboutsummaryrefslogtreecommitdiff
path: root/vendor/argparse.d.tl
diff options
context:
space:
mode:
authortobil4sk <tobil4sk@outlook.com>2026-02-03 22:47:50 +0000
committerGitHub <noreply@github.com>2026-02-03 19:47:50 -0300
commit47301d83aba58925e1b9594023621ebb27070cdb (patch)
tree73021b5366687ec1683b9e66505e74f22f71d31b /vendor/argparse.d.tl
parentacf1f47e7f1b1ecbc147e41cae51ddfd06ad898d (diff)
downloadluarocks-main.tar.gz
luarocks-main.tar.bz2
luarocks-main.zip
Improve flexibility around vendored librariesmain
compat53 is vendored since #1757 as it is required to run luarocks with lua 5.1 or 5.2. However, this introduced some issues as the GNUmakefile install rule places these in the same place where `luarocks install compat53` would install them. This means you get conflicts if you install the actual package: ``` Warning: /.../prefix/share/lua/5.1/compat53/init.lua is not tracked by this installation of LuaRocks. Moving it to /.../prefix/share/lua/5.1/compat53/init.lua~ Warning: /.../prefix/share/lua/5.1/compat53/module.lua is not tracked by this installation of LuaRocks. Moving it to /.../prefix/share/lua/5.1/compat53/module.lua~ Warning: /.../prefix/share/lua/5.1/compat53/file_mt.lua is not tracked by this installation of LuaRocks. Moving it to /.../prefix/share/lua/5.1/compat53/file_mt.lua~ ``` It is also not ideal for linux package maintainers to include a vendored package, see: https://github.com/luarocks/luarocks/pull/1757#issuecomment-3409873412. To solve these issues, this patchset makes the following changes: - GNUmakefile now places the compat53 files under `luarocks/vendor/compat53` (which is added internally to the luarocks script's `package.path`). This way a user's installation of compat53 does not interfere at all with luarocks one. - Added `--with-system-compat53` option to configure script for external packaging systems. - Fixed install.bat's logic for deciding whether to vendor compat53, as the current script includes it for every version. install.bat already places luarocks sources outside of LUAPATH, so that part can stay as is. I've also inverted the version check to avoid the need for future patches like: #1850.
Diffstat (limited to 'vendor/argparse.d.tl')
-rw-r--r--vendor/argparse.d.tl111
1 files changed, 111 insertions, 0 deletions
diff --git a/vendor/argparse.d.tl b/vendor/argparse.d.tl
new file mode 100644
index 00000000..812786c4
--- /dev/null
+++ b/vendor/argparse.d.tl
@@ -0,0 +1,111 @@
1
2local record argparse
3 type Args = {string : {string} | string | boolean}
4
5 record Parser
6 name: function(self: Parser, name: string): Parser
7 description: function(self: Parser, description: string): Parser
8 epilog: function(self: Parser, epilog: string): Parser
9
10 flag: function(self: Parser, flag: string): Option
11 flag: function(self: Parser, shortalias: string, longalias: string): Option
12
13 parse: function(self: Parser, argv: {string}): Args
14 pparse: function(self: Parser, argv: {string}): boolean, Args | string
15
16 error: function(self: Parser, error: string)
17
18 argument: function(self: Parser, name: string, description: string): Argument
19
20 get_usage: function(self: Parser): string
21 get_help: function(self: Parser): string
22
23 option: function(self: Parser, name: string, description?: string, default?: string, convert?: function | {function}, args?: {string}, count?: integer | string): Option
24 option: function(self: Parser, name: string, description?: string, default?: string, convert?: {string:string}, args?: {string}, count?: integer | string): Option
25
26 require_command: function(self: Parser, require_command: boolean): Parser
27 command_target: function(self: Parser, command_target: string): Parser
28
29 command: function(self: Parser, name: string, description: string, epilog: string): Command
30
31 add_help: function(self: Parser, boolean)
32
33 help_max_width: function(self: Parser, number): Parser
34 add_help_command: function(self: Parser, ?string | {string: any}): Parser
35 add_complete_command: function(self: Parser, ?string | {string: any}): Parser
36
37 group: function(self: Parser, ...:any): Parser
38
39 -- TODO: should be Argument | Option
40 mutex: function(self: Parser, ...: any)
41
42 record Opts
43 name: string
44 description: string
45 epilog: string
46 end
47 metamethod __call: function(Parser, Opts): Parser
48 metamethod __call: function(Parser, string, string, string): Parser
49 end
50
51 type ActionCallback = function(args: Args, index: string, val: string | boolean | {string}, overwrite: boolean)
52
53 record Argument
54 choices: function(self: Argument, choices: {string}): Argument
55
56 convert: function(self: Argument, convert: function | {function}): Argument
57 convert: function(self: Argument, convert: {string:string}): Argument
58
59 args: function(self: Argument, args: string | integer): Argument
60
61 action: function(self: Argument, cb: ActionCallback)
62 end
63
64 record Option
65 name: function(self: Option, name: string): Option
66 description: function(self: Option, description: string): Option
67
68 argname: function(self: Option, argname: string | {string}): Option
69
70 count: function(self: Option, count: integer | string): Option
71
72 choices: function(self: Option, {string}): Option
73
74 default: function(self: Option, string): Option
75
76 defmode: function(self: Option, string): Option
77
78 target: function(self: Option, target: string): Option
79
80 args: function(self: Option, args: string|integer): Option
81
82 action: function(self: Option, cb: ActionCallback)
83
84 hidden_name: function(self: Option, string)
85
86 hidden: function(self: Option, boolean)
87
88 convert: function(self: Option, function)
89 end
90
91 record Command
92 summary: function(self: Command, summary: string): Command
93 description: function(self: Command, description: string): Command
94
95 argument: function(self: Command, name: string, description?: string): Argument
96
97 option: function(self: Command, name: string, description: string): Option
98
99 flag: function(self: Command, string, ?string): Option
100
101 handle_options: function(self: Command, boolean): Command
102
103 mutex: function(self: Command, ...: any) --! copied over from Parser
104
105 group: function(self: Command, ...:any): Command --! copied over from Parser
106 end
107
108 metamethod __call: function(self: argparse, name: string, description: string, epilog: string): Parser
109end
110
111return argparse