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.
32 lines
976 B
32 lines
976 B
package com.example.datacollect.command;
|
|
|
|
import com.example.datacollect.repository.ArticleRepository;
|
|
import com.example.datacollect.view.ConsoleView;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
public class HelpCommand implements Command {
|
|
|
|
// 1. 添加 Logger 成员
|
|
private static final Logger logger = LoggerFactory.getLogger(HelpCommand.class);
|
|
|
|
private final ConsoleView view;
|
|
|
|
public HelpCommand(ConsoleView view) {
|
|
this.view = view;
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "help";
|
|
}
|
|
|
|
@Override
|
|
public void execute(String[] args, ArticleRepository repository) {
|
|
logger.debug("用户请求查看帮助信息。");
|
|
|
|
// 保留原有的帮助信息输出
|
|
view.printInfo("Commands: crawl <url>, list, analyze, help, exit");
|
|
// 建议:将硬编码的命令列表改为动态获取(如果 Command 接口有 getType 或类似方法),目前保持原样
|
|
}
|
|
}
|
|
|