aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-22 17:49:09 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-10-21 13:30:51 -0300
commit1cfd606c4a9a7e1011e4c4a5f55d7ab4c0142ce2 (patch)
tree13e9d3c0bab0f8899cf9badfdd3bc2b36c6688d6
parentccfeb43e29a5632f0165c69d1adaa9a16479d512 (diff)
downloadluarocks-1cfd606c4a9a7e1011e4c4a5f55d7ab4c0142ce2.tar.gz
luarocks-1cfd606c4a9a7e1011e4c4a5f55d7ab4c0142ce2.tar.bz2
luarocks-1cfd606c4a9a7e1011e4c4a5f55d7ab4c0142ce2.zip
Teal: add type definition module luarocks.vendor.argparse
-rw-r--r--src/luarocks/vendor/argparse.d.tl111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/luarocks/vendor/argparse.d.tl b/src/luarocks/vendor/argparse.d.tl
new file mode 100644
index 00000000..812786c4
--- /dev/null
+++ b/src/luarocks/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