diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-01-25 17:08:32 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-01-25 17:08:32 +0000 |
| commit | 96c2c909ba7ec21a8eb349ef3902c68f9fa834a4 (patch) | |
| tree | 6762f3cef837be62bbf68a7a70053507a5cea4a2 /src/main/java | |
| parent | 16d861c2b995df00307ed8aac84f3ded280ea9c2 (diff) | |
Set source as path in CLI args
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/org/shedlang/compiler/cli/ShedCli.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/org/shedlang/compiler/cli/ShedCli.java b/src/main/java/org/shedlang/compiler/cli/ShedCli.java index 6e5d115b..c311e7bd 100644 --- a/src/main/java/org/shedlang/compiler/cli/ShedCli.java +++ b/src/main/java/org/shedlang/compiler/cli/ShedCli.java @@ -1,6 +1,7 @@ package org.shedlang.compiler.cli; import net.sourceforge.argparse4j.ArgumentParsers; +import net.sourceforge.argparse4j.ext.java7.PathArgumentType; import net.sourceforge.argparse4j.inf.ArgumentParserException; import net.sourceforge.argparse4j.inf.Namespace; import org.shedlang.compiler.ShedCompiler; @@ -8,6 +9,7 @@ import org.shedlang.compiler.backends.Backends; import org.shedlang.compiler.errors.CompilerError; import java.io.IOException; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Optional; @@ -24,7 +26,7 @@ public class ShedCli { } private static void compile(Namespace args) throws IOException, InterruptedException { - var sourcePath = Paths.get(args.getString("source")); + var sourcePath = args.<Path>get("source"); var compiler = new ShedCompiler(); @@ -45,7 +47,10 @@ public class ShedCli { var compileSubParser = subparsers.addParser("compile"); compileSubParser.setDefault("command", Command.COMPILE); - compileSubParser.addArgument("source").required(true); + compileSubParser + .addArgument("source") + .type(new PathArgumentType()) + .required(true); compileSubParser.addArgument("--target").choices(Backends.targetNames()).required(true); compileSubParser.addArgument("--profile").required(false); |
