2 changed files with 26 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||
package internal.hw.crawler.commands; |
|||
|
|||
import internal.hw.crawler.models.Article; |
|||
import internal.hw.crawler.repositories.ArticleRepository; |
|||
|
|||
public class ListCommand implements Command { |
|||
private final ArticleRepository articleRepository; |
|||
|
|||
public ListCommand(ArticleRepository articleRepository) { |
|||
this.articleRepository = articleRepository; |
|||
} |
|||
|
|||
@Override |
|||
public String getName() { |
|||
return "list"; |
|||
} |
|||
|
|||
@Override |
|||
public void execute(String[] args) { |
|||
for (Article article : articleRepository.getAll()) { |
|||
System.out.println(article); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue