From 80b80dde3e04654f96b75e8b8724a86de01d4a21 Mon Sep 17 00:00:00 2001 From: jonx8 <31346779+jonx8@users.noreply.github.com> Date: Sat, 30 Sep 2023 21:17:18 +0300 Subject: [PATCH] Change help --- src/main/java/ru/etu/petci/Main.java | 10 +++++++--- .../java/ru/etu/petci/handlers/JobCommand.java | 15 +++------------ .../{ContinueCommand.java => ObserveCommand.java} | 4 ++-- 3 files changed, 12 insertions(+), 17 deletions(-) rename src/main/java/ru/etu/petci/handlers/{ContinueCommand.java => ObserveCommand.java} (85%) diff --git a/src/main/java/ru/etu/petci/Main.java b/src/main/java/ru/etu/petci/Main.java index 65ec2ae..bdac537 100644 --- a/src/main/java/ru/etu/petci/Main.java +++ b/src/main/java/ru/etu/petci/Main.java @@ -26,7 +26,7 @@ public class Main { LOGGER = Logger.getLogger(Main.class.getName()); commandHandlersMap.put("init", new InitCommand()); - commandHandlersMap.put("continue", new ContinueCommand()); + commandHandlersMap.put("observe", new ObserveCommand()); commandHandlersMap.put("job", new JobCommand()); } @@ -51,7 +51,11 @@ public static void main(String[] args) { public static void showHelp() { System.out.println("Commands: "); System.out.println("init - configure repository for work with CI"); - System.out.println("continue - start repository monitoring"); - System.out.println("add - add new job"); + System.out.println("observe - start repository monitoring"); + System.out.println("job [arg]"); + System.out.println("\tdelete - delete job"); + System.out.println("\tactivate - activate job"); + System.out.println("\tdeactivate - activate job"); + System.out.println("\tlist - show list of jobs"); } } \ No newline at end of file diff --git a/src/main/java/ru/etu/petci/handlers/JobCommand.java b/src/main/java/ru/etu/petci/handlers/JobCommand.java index 0e6fb92..1807580 100644 --- a/src/main/java/ru/etu/petci/handlers/JobCommand.java +++ b/src/main/java/ru/etu/petci/handlers/JobCommand.java @@ -3,6 +3,8 @@ import java.util.HashMap; import java.util.Map; +import static ru.etu.petci.Main.showHelp; + public class JobCommand implements Command { private static final Map commandMap = new HashMap<>(); @@ -14,7 +16,6 @@ public class JobCommand implements Command { commandMap.put("list", new ListJobCommand()); } - @Override public int handle(String[] args) { if (args.length > 1) { @@ -23,17 +24,7 @@ public int handle(String[] args) { return cmd.handle(args); } } - showJobHelp(); + showHelp(); return 1; } - - - private void showJobHelp() { - System.out.println("Job command help:"); - System.out.println("add - add new job"); - System.out.println("delete (job name) - delete job"); - System.out.println("activate (job name) - activate job"); - System.out.println("deactivate (job name) - activate job"); - System.out.println("list - show list of jobs"); - } } diff --git a/src/main/java/ru/etu/petci/handlers/ContinueCommand.java b/src/main/java/ru/etu/petci/handlers/ObserveCommand.java similarity index 85% rename from src/main/java/ru/etu/petci/handlers/ContinueCommand.java rename to src/main/java/ru/etu/petci/handlers/ObserveCommand.java index 3c11d03..5923b38 100644 --- a/src/main/java/ru/etu/petci/handlers/ContinueCommand.java +++ b/src/main/java/ru/etu/petci/handlers/ObserveCommand.java @@ -10,9 +10,9 @@ import java.util.List; import java.util.logging.Logger; -public class ContinueCommand implements Command { +public class ObserveCommand implements Command { - private static final Logger LOGGER = Logger.getLogger(ContinueCommand.class.getName()); + private static final Logger LOGGER = Logger.getLogger(ObserveCommand.class.getName()); @Override public int handle(String[] args) {