File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/main/kotlin/kscript/util Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ import java.io.File
1212/* * Simple Kotlin facade for org.docopt.Docopt.Docopt(java.lang.String) .*/
1313class DocOpt (args : Array <String >, val usage : String ) {
1414
15- val docopt = Docopt (usage)
15+ val parsedArgs = Docopt (usage).parse(args.toList() )
1616
1717 private val myDO by lazy {
18- docopt.parse(args.toList()) .map {
18+ parsedArgs .map {
1919 it.key.removePrefix(" --" ).replace(" [<>]" .toRegex(), " " ) to it.value
2020 }.toMap()
2121 }
@@ -32,4 +32,8 @@ class DocOpt(args: Array<String>, val usage: String) {
3232 fun getNumber (key : String ) = myDO[key]!! .toString().toFloat()
3333
3434 fun getBoolean (key : String ) = myDO[key]!! .toString().toBoolean()
35+
36+ override fun toString (): String {
37+ return parsedArgs.toString()
38+ }
3539}
You can’t perform that action at this time.
0 commit comments