File tree 2 files changed +11
-5
lines changed
clikt/src/main/kotlin/com/github/ajalt/clikt
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -132,18 +132,22 @@ abstract class CliktCommand constructor(
132
132
*
133
133
* You should use [main] instead unless you want to handle output yourself.
134
134
*/
135
- fun parse (argv : Array <String >, context : Context ? = null) {
136
- createContext(context )
135
+ fun parse (argv : List <String >, parentContext : Context ? = null) {
136
+ createContext(parentContext )
137
137
Parser .parse(argv, this .context)
138
138
}
139
139
140
+ fun parse (argv : Array <String >, parentContext : Context ? = null) {
141
+ parse(argv.asList(), parentContext)
142
+ }
143
+
140
144
/* *
141
145
* Parse the command line and print helpful output if any errors occur.
142
146
*
143
147
* This function calls [parse] and catches and [CliktError]s that are thrown. Other error are allowed to
144
148
* pass through.
145
149
*/
146
- fun main (argv : Array <String >) {
150
+ fun main (argv : List <String >) {
147
151
try {
148
152
parse(argv)
149
153
} catch (e: PrintHelpMessage ) {
@@ -164,6 +168,8 @@ abstract class CliktCommand constructor(
164
168
}
165
169
}
166
170
171
+ fun main (argv : Array <String >) = main(argv.asList())
172
+
167
173
/* *
168
174
* Perform actions after parsing is complete and this command is invoked.
169
175
*
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ import com.github.ajalt.clikt.parsers.OptionParser.Invocation
9
9
import com.github.ajalt.clikt.parsers.OptionParser.ParseResult
10
10
11
11
internal object Parser {
12
- fun parse (argv : Array <String >, context : Context ) {
13
- parse(argv.asList() , context, 0 )
12
+ fun parse (argv : List <String >, context : Context ) {
13
+ parse(argv, context, 0 )
14
14
}
15
15
16
16
private tailrec fun parse (argv : List <String >, context : Context , startingArgI : Int ) {
You can’t perform that action at this time.
0 commit comments