166 people following this project (follow)

The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line input and related tasks. It allows you to display an help screen with an high degree of customization and a simple way to report syntax errors to the user. Everything that is boring and repetitive to be programmed stands up on library shoulders, so you can concentrate yourself on core logic. The search for the command line parser for your application is over, with this library you got a solid parsing API constantly updated since 2005.

Latest available stable download: 1.8 stable.
Latest available download: 1.8.0.7 beta.
Latest available version on source code repository: 1.9.1.0 beta (May 2012).

News

  • Latest sources are now moved to github.com: https://github.com/gsscoder/commandline.
  • Test code moved to an external project, CommandLine.Tests.
  • Library available via NuGet: Install-Package CommandLine.

Overview

The command line input, read from the standard entry point as string array, is then pushed in an instance of a custom type decorated with library attributes. You just create this class with one field for each option value you want to make persistent (and a special field for non-option values). Rules about command line options are engraved in your custom type from library attributes.

  1. The library source code contains a sample application that will clarify all told up to this moment. In this sample you'll not find how to use mutually exclusive options, please read this test source file (explore the code also looking at this folder).
  2. More informations on User Guide.
  3. The OptionArray attribute, introduced from version 1.7.0.1 alfa, allow a greater flexibility in the parsing process.

Consuming The Code

The project is entirely written in C# and is also thought to be included in another (C#) project. Anyway you can reference the library as binary DLL file, consuming it from any .NET language. Depending on your IDE, it's possible to take advantage of documentation comments attached to any publicly visible member.

Input Specification

Reason To Use

  1. Remove from each application the code specific for command line parsing.
  2. Promote code reuse through a consistent, clear and easy to use API.
  3. The API is lightweight, has no external dependencies and is easy to integrate within an application.
  4. The project and its documentation are continuously updated and extended.
  5. It has been used for years in closed and open source projects.
  6. This project has also grown through the interaction of enthusiastic users and from constructive criticism.
  7. Comments and various types of communication are taken seriously by the author.

Compatibility

  • CSharp 3.0+
  • .NET Framework 2.0+
  • Mono Profile 2.1+

Each stable release is also tested under Mono on Linux (Debian based distros) and Mac OS X. This project contains unit tests from first release.

Contributor(s)

  • Steven Evans (blog)

Projects using this library

Contacts & Other

For go deeper on the usage, for bug reports and features requests:

Remember also to take advantage of all greats CodePlex features (like Discussions and Issue Tracker).

Please Support

If you use this project and you want help the author to keep it updated, please consider make a donation.
Donations are made through PayPal Donate button present below and in the author's blog at gsscoder.blogspot.com.

PayPal - The safer, easier way to pay online!

Last edited Wed at 8:40 PM by gsscoder, version 123