|
|
@ -8,13 +8,14 @@ import com.github.ajalt.clikt.parameters.options.default |
|
|
|
import java.io.InputStream |
|
|
|
import java.io.InputStream |
|
|
|
import java.io.OutputStream |
|
|
|
import java.io.OutputStream |
|
|
|
import java.nio.file.Files |
|
|
|
import java.nio.file.Files |
|
|
|
|
|
|
|
import java.nio.file.Paths |
|
|
|
|
|
|
|
|
|
|
|
fun RawOption.inputStream(): NullableOption<InputStream, InputStream> { |
|
|
|
fun RawOption.inputStream(): NullableOption<InputStream, InputStream> { |
|
|
|
return convert("FILE") { |
|
|
|
return convert("FILE") { |
|
|
|
return@convert if (it == "-") { |
|
|
|
return@convert if (it == "-") { |
|
|
|
System.`in` |
|
|
|
System.`in` |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Files.newInputStream(java.nio.file.Paths.get(it)) |
|
|
|
Files.newInputStream(Paths.get(it)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -28,7 +29,7 @@ fun RawOption.outputStream(): NullableOption<OutputStream, OutputStream> { |
|
|
|
return@convert if (it == "-") { |
|
|
|
return@convert if (it == "-") { |
|
|
|
System.out |
|
|
|
System.out |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Files.newOutputStream(java.nio.file.Paths.get(it)) |
|
|
|
Files.newOutputStream(Paths.get(it)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|