From dd1aeb9066f9820eb6095b3e97671c3e585c0a97 Mon Sep 17 00:00:00 2001
From: Eric Duminil <eric.duminil@gmail.com>
Date: Fri, 7 Oct 2022 16:40:22 +0200
Subject: [PATCH] Trying another api

---
 .../RegionChooserCommandLineInterface.java    | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java b/src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
index 2bf2a18..1a3be14 100644
--- a/src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
+++ b/src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
@@ -7,22 +7,24 @@
 import picocli.CommandLine;
 import picocli.CommandLine.Command;
 import picocli.CommandLine.Option;
-import picocli.CommandLine.Parameters;
 
 
-@Command(name = "region_chooser", mixinStandardHelpOptions = true, version = "regionChooser x.x", description = "Extracts a region from one or more citygmls.")
+@Command(name = "region_chooser", mixinStandardHelpOptions = true, version = "regionChooser x.x", description = "Extracts a region from one or more citygmls.", sortOptions = false)
 class RegionChooserCommandLineInterface implements Callable<Integer>
 {
-	@Parameters(index = "0", description = "SRS Name : 'EPSG:31467' or just 31467")
-	String srsName;
+	@Option(names = { "-i",
+			"--input" }, required = true, split = ",", description = "Citygml files to extract from", paramLabel = "input.gml")
+	List<Path> citygmls;
 
-	@Parameters(index = "1", description = "Output file : output.gml", paramLabel = "<output_citygml>")
+	@Option(names = { "-o",
+			"--output" }, required = true, description = "Output file", paramLabel = "output.gml")
 	Path outputCityGML;
 
-	@Parameters(index = "2..*", arity = "1..*", description = "The citygml files to extract from : input1.gml input2.gml")
-	List<Path> citygmls;
+	@Option(names = { "-e", "--epsg" }, description = "EPSG id for coordinate reference system", paramLabel = "31467")
+	Integer espgId;
 
-	@Option(names = "--wkt", description = "File containing WKT polygon, or - for stdin", paramLabel = "file")
+	@Option(names = { "-w",
+			"--wkt" }, description = "File containing WKT polygon, or - for stdin", paramLabel = "polygon.wkt")
 	String wktFile = "-";
 
 	@Override
@@ -36,7 +38,7 @@ public Integer call() throws Exception { // your business logic goes here...
 		System.out.print("And write to : ");
 		System.out.println(outputCityGML);
 		System.out.print("in ");
-		System.out.println(srsName + " coordinates.");
+		System.out.println(espgId + " coordinates.");
 
 		if (System.in.available() == 0) {
 			System.out.println("OH NOEs, NO INPUT!");
-- 
GitLab