<commit_before>package com.globalsight.tools;

import java.util.Formatter;

import org.apache.commons.cli.CommandLine;

// TODO: add filters
public class ShowJobsCommand extends WebServiceCommand {

    @Override
    protected void execute(CommandLine command, UserData userData,
            WebService webService) throws Exception {
        for (Job job : webService.getJobs()) {
            printShort(job);
        }
    }

    void printShort(Job job) {
        Formatter f = new Formatter(System.out);
        // XXX Hack: just displaying the first WFId
        f.format("%-8s%-4s%-14s%s\n", job.getId(), 
        		job.getWorkflows().get(0).getId(), job.getDisplayState(), 
                 job.getName());
    }
    
    @Override
    public String getDescription() {
        return "List jobs for this company";
    }
}
<commit_msg>jobs for specific ids basically works now<commit_after>package com.globalsight.tools;

import java.util.ArrayList;
import java.util.Formatter;
import java.util.List;

import org.apache.commons.cli.CommandLine;

// TODO: add filters
public class ShowJobsCommand extends WebServiceCommand {

    @Override
    protected void execute(CommandLine command, UserData userData,
        WebService webService) throws Exception {
        List<String> args = command.getArgList();
        List<Job> jobs = webService.getJobs();
        if (args.size() == 0) {
            showAllJobs(jobs);
        }
        else {
            List<Job> jobsToShow = new ArrayList<Job>();
ARGLOOP:    
            for (String arg: args) {
                Long id = parseId(arg);
                if (id == null) {
                    System.out.println("Skipping '" + arg + "': not an id");
                    continue;
                }
                for (Job j : jobs) {
                    if (j.getId().equals(arg)) { // TODO: jobs need numeric IDs
                        jobsToShow.add(j);
                        continue ARGLOOP;
                    }
                }
                System.out.println("Skipping '" + arg + "': no such job");
            }
            if (jobsToShow.size() == 0) {
                return;
            }
            for (Job j : jobsToShow) {
                // XXX Only doing the first workflow
                Task t = webService.getCurrentTask(j.getWorkflows().get(0));
                System.out.println("Job " + j.getId() + ", task " + t.getId() +
                                ", " + t.getName() + " -- " + t.getState());
            }
        }
    }
    
    private Long parseId(String s) {
        try {
            return Long.valueOf(s);
        }
        catch (NumberFormatException e) {
            return null;
        }
    }

    void showAllJobs(List<Job> jobs) throws Exception {
        printHeader();
        for (Job job : jobs) {
            printShort(job);
        }
    }
    void printHeader() {
    	Formatter f = new Formatter(System.out);
    	f.format("%-8s%-8s%-12s%s\n", "ID", "WFID", "State", "Name");
    }
    void printShort(Job job) {
        Formatter f = new Formatter(System.out);
        // XXX Hack: just displaying the first WFId
        f.format("%-8s%-4s%-14s%s\n", job.getId(), 
        		job.getWorkflows().get(0).getId(), job.getDisplayState(), 
                 job.getName());
    }
    
    @Override
    public String getDescription() {
        return "List jobs for this company";
    }
}

{'fraction_non_alphanumeric': 0.11834992887624467, 'fraction_numerical': 0.0048364153627311526, 'mean_word_length': 1.5645514223194747, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4731554', 'n_tokens_mistral': 1027, 'n_tokens_neox': 975, 'n_words': 231}