SIP & Performance

Open-source assets, tools and production-ready components for telecom builders

CliParseWizard

Lightweight Java library for building command-line applications. Provides declarative command and argument definitions (flags, positional, key=value and multiple values), an input parser, validation, help generation and a simple command dispatcher.

Key features

Installation (Maven)

<dependency>
    <groupId>com.siperf</groupId>
    <artifactId>cliparsewizard</artifactId>
    <version>1.0.0</version>
</dependency>

Quick start

import com.siperf.cliparsewizard.CLIProcessor;
import com.siperf.cliparsewizard.ParsingResult;
import com.siperf.cliparsewizard.command.Command;
import com.siperf.cliparsewizard.argument.types.PositionalArgument;
import com.siperf.cliparsewizard.argument.types.FlagArgument;

public class QuickStart {
    public static void main(String[] args) {
        CLIProcessor processor = new CLIProcessor();

        Command greet = processor.getCommandBuilder()
            .setCommandName("greet")
            .addArgument(new PositionalArgument("name", true, null))
            .addArgument(new FlagArgument("verbose", false, null))
            .setExecutable(result -> {
                String name = (String) result.getParsedArguments().get("name");
                boolean verbose = result.getParsedArguments().get("verbose") != null;
                if (verbose) {
                    System.out.println("Hello, " + name + " (verbose)");
                } else {
                    System.out.println("Hello, " + name);
                }
            })
            .build();

        String[] argv = args.length == 0 ? new String[] {"greet", "Alice", "--verbose"} : args;
        ParsingResult res = processor.process(argv);
    }
}

Examples and documentation

Detailed usage examples, architecture notes and API docs are available in the Docs section.

Implementation notes

License

Links