Skip to content

easy-develop/argument-parser

Repository files navigation

Table of contents

Overview

An easy to use and lightweight library for parsing the command line arguments. Supports specifying optional arguments. Values available in command line argument are used to create an instance for given class, which can further be used to retrieve the values.

Feature Highlights

  • Can specify optional arguments
  • Instance of given class is created with available values which can be used as needed
  • Alias to argument options can be specified
  • A value in command line argument can an array of elements separated by used defined delimiter
  • Values in the command line argument are directly converted to supported data types instead of treating everything as String. See API for list of supported data types
  • Is thread safe

Short Description

Often, the developers find themselves rolling their own logic for handling the command line arguments and read the values in command line arguments directly, based on indices. This approach makes the code fragile and cumbersome since playing directly with the array indices is risky at best. And, if the format in which arguments are expected is to change, correcting this short in-house logic becomes yet more difficult to handle. There are some libraries which provide features for parsing command line arguments, but they are a bit difficult to use. So, here is a library which provides very simple APIs to perform this task in an efficient way. For details on API, see the Javadoc

Prerequisites

  • Java 1.5 or above

Getting started

First of all, include the jar for this library in your project. If you are using maven, add below dependency to your pom.xml:

<dependency>
    <groupId>com.github.easy-develop</groupId>
    <artifactId>argument-parser</artifactId>
    <version>1.0.1</version>
</dependency>

If you are using any other build tool, have a look at Maven Repository page on how to include the dependency

On how to use the APIs, have a look at the examples

Support

Please open an issue if you have any suggestion or need an assistance

License

This project is licensed under MIT

About

Parse command line arguments or any array of strings into user specified class

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages