Fixed arguments checks.
This commit is contained in:
parent
aa3fa295d9
commit
f1d0dcb03b
2 changed files with 2 additions and 2 deletions
|
@ -8,7 +8,7 @@ import java.nio.file.Path;
|
|||
|
||||
public class ReadingTimeSample {
|
||||
public static void main(String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length >= 1) {
|
||||
final Path text = Path.of(args[0]);
|
||||
try {
|
||||
final ReadingTime rt = new ReadingTime(Files.readString(text));
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.thauvin.erik.readingtime.ReadingTime.Companion.imgCount
|
|||
import net.thauvin.erik.readingtime.ReadingTime.Companion.wordCount
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (args.size == 1) {
|
||||
if (args.isNotEmpty()) {
|
||||
val text = File(args[0])
|
||||
if (text.exists() && text.canRead()) {
|
||||
val rt = ReadingTime(text.readText())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue