Commons CLI

コンポーネント レポジトリ

Sandboxコンポーネント

日本語訳 (Translations)

オリジナル

Introduction

By default, CLI uses a POSIX style argument parser. This parser only provides support for single character options. To provide support for an application like Ant it is necessary to use the GNU style argument parser. This provides support for multi character options. Read on to discover how to configure this parser and also how to process the command line options.


Configuring the GNU Parser

CLI provides support for multiple parsers. The org.apache.commons.cli.parser system property is used to determine what parser to use. To change the parser set the system property to the class name of the required parser.

// configure CLI to use the GNU Parser
System.setProperty( "org.apache.commons.cli.parser",
                    "org.apache.commons.cli.GnuParser" );


Creating the Ant Options

There are three types of Options used in Ant. They are:

  • boolean option - the option is either present or not
  • value option - the option is present and requires a value
  • property option - the same style as Java system properties. For example, "-Dproperty=value".



Copyright © 1999-2007, Apache Software Foundation
Translated into Japanese by Tetsuya Kitahata , powered by Terra-International, Inc.
Original English Page would be found from HERE     --    ApacheNews    ASF プロジェクト一覧
Terra-International, Inc. -- テラ・インターナショナル
Special Thanks -- 【お問い合わせ/テキスト広告】