package forager.newui;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;

import joptsimple.OptionParser;
import joptsimple.OptionSpec;

public class Server implements Command {

    public static int DEFAULT_PORT = 53380;

    private OptionParser parser = new OptionParser();

    public void execute(String[] args) throws Exception {
        OptionSpec<Integer> port = parser.acceptsAll(
                Arrays.asList("p", "port"), "Server port")
            .withRequiredArg()
            .ofType(Integer.class)
            .defaultsTo(DEFAULT_PORT);

        OptionSpec<?> reset = parser.acceptsAll(
                Arrays.asList("r", "reset"), "Reset (clear) the task list");

        OptionSpec<File> taskList = parser.acceptsAll(
                Arrays.asList("t", "tasklist", "task-list"),
                "Path to the task list (created if it doesn't exist)")
            .withRequiredArg()
            .ofType(File.class)
            .defaultsTo(new File("./tasklist"));

        printUsage();
    }

    public String name() {
        return "server";
    }

}

@@ -1089,10 +1089,213 @@
 %0A    %7D%0A%0A
-%7D
+    public void printUsage()%0A    throws IOException %7B%0A        System.out.println(%22Usage: forager %22 + name() + %22 %5Boptions%5D%22);%0A        System.out.println();%0A        parser.printHelpOn(System.out);%0A    %7D%0A%0A%7D%0A
 %0A

Add usage info method