diff --git a/src/main/java/com/mycmd/App.java b/src/main/java/com/mycmd/App.java index 1458f14..e6c301a 100644 --- a/src/main/java/com/mycmd/App.java +++ b/src/main/java/com/mycmd/App.java @@ -51,5 +51,6 @@ private static void registerCommands(Map commands) { commands.put("help", new HelpCommand(commands)); commands.put("exit", new ExitCommand()); commands.put("ver", new VersionCommand()); + commands.put("date", new DateCommand()); } } diff --git a/src/main/java/com/mycmd/commands/DateCommand.java b/src/main/java/com/mycmd/commands/DateCommand.java new file mode 100644 index 0000000..33f6893 --- /dev/null +++ b/src/main/java/com/mycmd/commands/DateCommand.java @@ -0,0 +1,12 @@ +package com.mycmd.commands; + +import com.mycmd.Command; +import com.mycmd.ShellContext; +import java.time.LocalDate; + +public class DateCommand implements Command { + @Override + public void execute(String[] args, ShellContext context) { + System.out.println("The current date is: " + java.time.LocalDate.now()); + } +}