You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
677 B
31 lines
677 B
package com.crawler.command;
|
|
|
|
import com.crawler.view.ConsoleView;
|
|
|
|
public class ExitCommand implements Command {
|
|
private final ConsoleView view;
|
|
private Runnable exitCallback;
|
|
|
|
public ExitCommand(ConsoleView view, Runnable exitCallback) {
|
|
this.view = view;
|
|
this.exitCallback = exitCallback;
|
|
}
|
|
|
|
@Override
|
|
public void execute(String[] args) {
|
|
view.displayGoodbye();
|
|
if (exitCallback != null) {
|
|
exitCallback.run();
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public String getCommandName() {
|
|
return "exit";
|
|
}
|
|
|
|
@Override
|
|
public String getDescription() {
|
|
return "Exit the application";
|
|
}
|
|
}
|
|
|