Skip to content

Commit 45acb7b

Browse files
Merge pull request #78 from Ishara-Vithanage/main
[ENHANCEMENT] Updated "Command Not Found" prompt to provide guidance for available commands
2 parents 810028b + 8f23db8 commit 45acb7b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/com/mycmd/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static void main(String[] args) {
4242
}
4343
} else {
4444
// Single, clear not-recognized message + optional suggestion
45-
System.out.println("'" + cmd + "' is not recognized as an internal or external command.");
45+
System.out.println("Unknown command: '" + cmd + "'. Enter 'help' to list all available commands.");
4646

4747
// compute suggestion safely
4848
try {

src/main/java/com/mycmd/commands/DateCommand.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,14 @@ public class DateCommand implements Command {
2222
public void execute(String[] args, ShellContext context) {
2323
System.out.println("The current date is: " + java.time.LocalDate.now());
2424
}
25+
26+
@Override
27+
public String description() {
28+
return "Display current date.";
29+
}
30+
31+
@Override
32+
public String usage() {
33+
return "date";
34+
}
2535
}

0 commit comments

Comments
 (0)