forked from Drive-for-Java/MyCMD
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExitCommand.java
More file actions
34 lines (30 loc) · 829 Bytes
/
Copy pathExitCommand.java
File metadata and controls
34 lines (30 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.mycmd.commands;
import com.mycmd.Command;
import com.mycmd.ShellContext;
/**
* Terminates the MyCMD shell application.
*
* This command exits the shell by calling System.exit(0), which immediately
* terminates the JVM process with a success status code. A goodbye message
* is displayed before exiting.
*
* Usage: exit
*
* Note: This command does not accept any arguments and exits immediately
* without prompting for confirmation.
*/
public class ExitCommand implements Command {
@Override
public void execute(String[] args, ShellContext context) {
System.out.println("Exiting MyCMD...");
System.exit(0);
}
@Override
public String description() {
return "Exit the program.";
}
@Override
public String usage() {
return "exit";
}
}