Apache Commons CLI – Apache Commons CLI
Apache Commons CLI ™
Last Published: 08 Nov 2025
Version: 1.11.0
ApacheCon
Apache
Commons
Commons CLI
About
Asking Questions
Release History
Issue Tracking
Dependency Management
Sources
Security
License
Code of Conduct
Javadoc
Javadoc Current
Javadoc Archive
User Guide
Getting started
Using CLI
Option properties
Javadoc
Javadoc Archive
Project Documentation
Project Information
About
Summary
Team
Source Code Management
Issue Management
Mailing Lists
Maven Coordinates
Dependency Management
Dependencies
Dependency Convergence
CI Management
Distribution Management
Project Reports
Commons
License
Components
Sandbox
Dormant
General Information
Security
Volunteering
Contributing Patches
Building Components
Commons Parent POM
Commons Build Plugin
Commons Release Plugin
Site Publication
Releasing Components
Wiki
ASF
How the ASF works
Get Involved
Developer Resources
Code of Conduct
Sponsorship
Thanks
Apache Commons CLI
The Apache Commons CLI library provides an API for parsing command-line options passed to an application.
It can also print help detailing the options available for that application.
Commons CLI supports different types of options:
POSIX like options, for example
tar -zxvf foo.tar.gz
GNU like long options, for example
du --human-readable --max-depth=1
Java like properties, for example
java -Djava.awt.headless=true -Djava.net.useSystemProxies=true Foo
Short options with value attached, for example
gcc -O2 foo.c
long options with single hyphen, for example
ant -projecthelp
A typical help message displayed by Commons CLI looks like this:
usage: ls
-A,--almost-all do not list implied . and ..
-a,--all do not hide entries starting with .
-B,--ignore-backups do not list implied entried ending with ~
-b,--escape print octal escapes for nongraphic characters
--block-size
-c with -lt: sort by, and show, ctime (time of last
modification of file status information) with
-l:show ctime and sort by name otherwise: sort
by ctime
-C list entries by columns
Check out the
introduction
page for a detailed presentation.
Documentation
A full
User's Guide
is available
as are various
project reports
The Javadoc API documents are available online:
Javadoc latest
Javadoc archives
The
source repository
can be
browsed
Releases
the latest version.
The
release notes
are also available.
For previous releases, see the
Apache Archive
Support
The
commons mailing lists
act as the main support forum. The user list
is suitable for most library usage queries. The dev list is intended for the development discussion. Please
remember that the lists are shared between all commons components, so prefix your email subject by
[cli]
Issues may be reported via the
ASF JIRA
CLI 2?
Commons CLI 1.0 was formed from the merger of ideas and code from three different libraries -
Werken, Avalon and Optz. In dealing with the bugs and the feature requests a freshly designed and not
backwards compatible CLI 2 was created in 2004, but never finished or released.
The current plan is to continue to maintain the 1.x line. The CLI2 work may be found in the Commons Sandbox.
Copyright © 2002-2025
The Apache Software Foundation
Apache Commons, Apache Commons CLI, Apache, the Apache logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation.
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
US