class ChronicleWriterMain {

    public void run(@NotNull String[] args) throws Exception {
        final Options options = options();
        final CommandLine commandLine = parseCommandLine(args, options);

        final ChronicleWriter writer = new ChronicleWriter();

        configure(writer, commandLine);

        writer.execute();
    }

    private CommandLine parseCommandLine(final @NotNull String[] args, final Options options) {
        final CommandLineParser parser = new DefaultParser();
        CommandLine commandLine = null;
        try {
            commandLine = parser.parse(options, args);

            if (commandLine.hasOption('h')) {
                printHelpAndExit(options, 0, null);
            }

            if (commandLine.getArgList().isEmpty()) {
                printHelpAndExit(options, 1, "Need files...");
            }
        } catch (ParseException e) {
            printHelpAndExit(options, 1, e.getMessage());
        }

        return commandLine;
    }

    private void printHelpAndExit(final Options options, int status, String message) {<FILL_FUNCTION_BODY>}

    private void configure(final ChronicleWriter writer, final CommandLine commandLine) {
        writer.withBasePath(Paths.get(commandLine.getOptionValue('d')));
        writer.withMethodName(commandLine.getOptionValue('m'));

        if (commandLine.hasOption('i')) {
            final String r = commandLine.getOptionValue('i');
            writer.asMethodWriter(r.equals("null") ? null : r);
        }

        writer.withFiles(commandLine.getArgList());
    }

    @NotNull
    private Options options() {
        final Options options = new Options();

        addOption(options, "m", "method", true, "Method name", true);
        addOption(options, "d", "directory", true, "Directory containing chronicle queue to write to", true);
        addOption(options, "i", "interface", true, "Interface to write via", false);
        return options;
    }
}

        final PrintWriter writer = new PrintWriter(System.out);
        new HelpFormatter().printHelp(
                writer,
                180,
                this.getClass().getSimpleName() + " files..",
                message,
                options,
                HelpFormatter.DEFAULT_LEFT_PAD,
                HelpFormatter.DEFAULT_DESC_PAD,
                null,
                true
        );
        writer.flush();
        System.exit(status);
    
<no_super_class>