<commit_before>package fi.helsinki.cs.tmc.cli.command;

import fi.helsinki.cs.tmc.core.TmcCore;
import fi.helsinki.cs.tmc.core.configuration.TmcSettings;
import fi.helsinki.cs.tmc.core.domain.Course;
import fi.helsinki.cs.tmc.core.domain.ProgressObserver;
import fi.helsinki.cs.tmc.langs.util.TaskExecutor;
import fi.helsinki.cs.tmc.langs.util.TaskExecutorImpl;

import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * Command for listing all available courses to user.
 */
public class ListCoursesCommand implements Command {
    @Override
    public String getDescription() {
        return "List the available courses.";
    }

    @Override
    public String getName() {
        return "list-courses";
    }

    @Override
    public void run() {
        Callable<List<Course>> callable;
        TaskExecutor tmcLangs;
        TmcCore core;
        String filename = System.getProperty("user.home") + File.separator + ".tmc";

        tmcLangs = new TaskExecutorImpl();
        //core = new TmcCore(settings, tmcLangs);
        //callable = core.listCourses(ProgressObserver.NULL_OBSERVER);
        //List<Course> list = callable.call();
    }
}<commit_msg>Implement the list courses command.<commit_after>package fi.helsinki.cs.tmc.cli.command;

import fi.helsinki.cs.tmc.cli.tmcstuff.Settings;

import fi.helsinki.cs.tmc.core.TmcCore;
import fi.helsinki.cs.tmc.core.configuration.TmcSettings;
import fi.helsinki.cs.tmc.core.domain.Course;
import fi.helsinki.cs.tmc.core.domain.ProgressObserver;
import fi.helsinki.cs.tmc.langs.util.TaskExecutor;
import fi.helsinki.cs.tmc.langs.util.TaskExecutorImpl;

import java.io.File;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * Command for listing all available courses to user.
 */
public class ListCoursesCommand implements Command {
    @Override
    public String getDescription() {
        return "List the available courses.";
    }

    @Override
    public String getName() {
        return "list-courses";
    }

    @Override
    public void run() {
        Callable<List<Course>> callable;
        List<Course> courses;
        TaskExecutor tmcLangs;
        Settings settings = new Settings();
        TmcCore core;

        tmcLangs = new TaskExecutorImpl();
        core = new TmcCore(settings, tmcLangs);
        callable = core.listCourses(ProgressObserver.NULL_OBSERVER);
        try {
            courses = callable.call();
        } catch (Exception e) {
            return;
        }
        for (Course course : courses) {
            System.out.println(course.getName());
        }
    }
}
{'fraction_non_alphanumeric': 0.11281070745697896, 'fraction_numerical': 0.0, 'mean_word_length': 2.957639939485628, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4370554', 'n_tokens_mistral': 845, 'n_tokens_neox': 820, 'n_words': 166}