1.0.3 Add a help message for easier usage

master
yanng@vidconnect.cyou 1 month ago
parent badb68c8a9
commit 530909e817

@ -27,6 +27,14 @@ public class Splicer {
private static final Logger logger = Logger.getLogger(Splicer.class.getName()); private static final Logger logger = Logger.getLogger(Splicer.class.getName());
public static void main(String[] args) throws InterruptedException, JsonProcessingException { public static void main(String[] args) throws InterruptedException, JsonProcessingException {
if (args.length == 0) {
System.out.println("This program allows you to run several commands at the same time."
+ "\n\nUsage: Splicer.java cmd1 cmd2 cmd3 ..."
+ "\n\nExample: ./Splicer.java \"ls -l\" \"df -kh\"\n");
return;
}
ExecutorService executorService = Executors.newFixedThreadPool(args.length); ExecutorService executorService = Executors.newFixedThreadPool(args.length);
List<Callable<ExecutionResult>> callables = List.of(args).stream() List<Callable<ExecutionResult>> callables = List.of(args).stream()

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cyou.vidconnect</groupId> <groupId>cyou.vidconnect</groupId>
<artifactId>splicer</artifactId> <artifactId>splicer</artifactId>
<version>1.0.2</version> <version>1.0.3</version>
<name>splicer</name> <name>splicer</name>
<description>Run multiple shell commands concurrently</description> <description>Run multiple shell commands concurrently</description>
<properties> <properties>

@ -24,6 +24,14 @@ public class Main {
private static final Logger logger = Logger.getLogger(Main.class.getName()); private static final Logger logger = Logger.getLogger(Main.class.getName());
public static void main(String[] args) throws InterruptedException, JsonProcessingException { public static void main(String[] args) throws InterruptedException, JsonProcessingException {
if (args.length == 0) {
System.out.println("This program allows you to run several commands at the same time."
+ "\n\nUsage: java -jar splicer.jar cmd1 cmd2 cmd3 ..."
+ "\n\nExample: java -jar splicer.jar \"ls -l\" \"df -kh\"\n");
return;
}
ExecutorService executorService = Executors.newFixedThreadPool(args.length); ExecutorService executorService = Executors.newFixedThreadPool(args.length);
List<Callable<ExecutionResult>> callables = List.of(args).stream() List<Callable<ExecutionResult>> callables = List.of(args).stream()

Loading…
Cancel
Save