|
7 | 7 | import java.io.BufferedReader;
|
8 | 8 | import java.io.IOException;
|
9 | 9 | import java.io.InputStreamReader;
|
| 10 | +import java.nio.file.Files; |
10 | 11 | import java.nio.file.Path;
|
| 12 | +import java.nio.file.Paths; |
11 | 13 | import java.util.function.Consumer;
|
12 | 14 | import java.util.function.Predicate;
|
| 15 | +import java.util.stream.Collectors; |
13 | 16 | import java.util.stream.Stream;
|
14 | 17 | import org.nqm.config.GisConfig;
|
15 | 18 | import org.nqm.config.GisLog;
|
@@ -129,6 +132,17 @@ void listBranches(
|
129 | 132 | forEachModuleDo(path -> deployVertx(path, args));
|
130 | 133 | }
|
131 | 134 |
|
| 135 | + @Command(name = "init", description = "init .gis-modules for current directory") |
| 136 | + void init() throws IOException { |
| 137 | + var data = Files.list(Path.of(".")) |
| 138 | + .filter(Files::isDirectory) |
| 139 | + .map(p -> p.getFileName()) |
| 140 | + .map("path = %s"::formatted) |
| 141 | + .collect(Collectors.joining("\n")) |
| 142 | + .getBytes(); |
| 143 | + Files.write(Paths.get(".gis-modules"), data); |
| 144 | + } |
| 145 | + |
132 | 146 | private static Stream<String> streamOf(String[] input) {
|
133 | 147 | return Stream.of(input).map(String::trim).distinct();
|
134 | 148 | }
|
|
0 commit comments