AdaCL.Command_Line.GetOpt

Ada Class Library Analyse command line

More...

Entities

Constants and variables

Help_GNU
Help_Short
Option_Argument
Option_Error
Option_Marker

Simple types

FoundFlag

Tagged types

Object

Subprograms

Put_Help_Line
Put_Help_Line
Put_Help_Line
Put_Help_Line
Put_Help_Line

Dispatching subprograms

Analyze_File
Analyze_GNU
Analyze_WithArgument
Analyze_WithoutArgument
Get_Argument
Get_ExtractGNU
Get_GNUOption
Get_Optind
Get_Option
Get_Pattern
Next
Parse
Set_ExceptionOnError
Set_ExtractGNU
Set_Pattern
WriteHelp

Nested packages

Unbounded

Description

A modern object oriented version of GetOpt made for Ada - that's without the C style ugliness. Also, unlike for example GNAT.Command_Line this package is re-entrant. All internal states are kept inside the class instance so two tasks can parse the command line in parallel. Last not least this command line parser has wide character support for short options, long options and file names.

Help_GNU [source]

81Help_GNU : constant Wide_Wide_String;

GNU Option to request Help

Help_Short [source]

86Help_Short : constant Wide_Wide_Character;

Short Option to request Help

Option_Argument [source]

96Option_Argument : constant Wide_Wide_Character;

Options with Arguments.

Option_Error [source]

91Option_Error : constant Wide_Wide_Character;

Flags an Error, unknown options are errors

Option_Marker [source]

101Option_Marker : constant Wide_Wide_Character;

Character with which all options start

FoundFlag [source]

70 type FoundFlag is
71 (EndOfOptions,
72 NoOption,
73 GNU_Style,
74 WithArgument,
75 WithoutArgument,
76 Error);

Return values. The C version had only two states: -1 error, > 0 option character.

EndOfOptions

no more options

NoOption

no option

GNU_Style

GNU style option

WithArgument

option with argument

WithoutArgument

option without argument

Error

parser encountered error

Object [source]

60 type Object is tagged private;

internale data

Put_Help_Line [source]

159 procedure Put_Help_Line (Evironment_Variable : String);

Print a help line

Evironment_Variable of type String

Name of alternative environment variable.

Put_Help_Line [source]

166 procedure Put_Help_Line (Long : Wide_Wide_String; Description : Wide_Wide_String) with
167 Pre => (Long'Length < 20);

Print a help line

Long of type Wide_Wide_String

Long GNU style option

Description of type Wide_Wide_String

description of option

Put_Help_Line [source]

175 procedure Put_Help_Line
176 (Short : Wide_Wide_Character;
177 Long : Wide_Wide_String;
178 Description : Wide_Wide_String) with
179 Pre => (Long'Length < 20);

Print a help line

Short of type Wide_Wide_Character

Short option

Long of type Wide_Wide_String

Long GNU style option

Description of type Wide_Wide_String

description of option

Put_Help_Line [source]

187 procedure Put_Help_Line
188 (Long : Wide_Wide_String;
189 Option : Wide_Wide_String;
190 Description : Wide_Wide_String) with
191 Pre => (Option'Length + 1 < 10) and then (Long'Length + Option'Length + 1 < 20);

Print a help line

Long of type Wide_Wide_String

Long GNU style option

Option of type Wide_Wide_String

parameter for option

Description of type Wide_Wide_String

description of option

Put_Help_Line [source]

200 procedure Put_Help_Line
201 (Short : Wide_Wide_Character;
202 Long : Wide_Wide_String;
203 Option : Wide_Wide_String;
204 Description : Wide_Wide_String) with
205 Pre => (Option'Length + 1 < 10) and then (Long'Length + Option'Length + 1 < 20);

Print a help line

Short of type Wide_Wide_Character

Short option

Long of type Wide_Wide_String

Long GNU style option

Option of type Wide_Wide_String

parameter for option

Description of type Wide_Wide_String

description of option

Analyze_File [source]

153 procedure Analyze_File (This : in out Object);

A File was found on the command line

This of type AdaCL.Command_Line.GetOpt.Object

the Object itself

Analyze_GNU [source]

147 procedure Analyze_GNU (This : in out Object);

A GNU Style was found on the command line

This of type AdaCL.Command_Line.GetOpt.Object

the Object itself

Analyze_WithArgument [source]

141 procedure Analyze_WithArgument (This : in out Object);

A Classic Style Option with Argument was found on the command line

This of type AdaCL.Command_Line.GetOpt.Object

the Object itself

Analyze_WithoutArgument [source]

135 procedure Analyze_WithoutArgument (This : in out Object);

A Classic Style Option without Argument was found on the command line

This of type AdaCL.Command_Line.GetOpt.Object

the Object itself

Get_Argument [source]

224 function Get_Argument (This : in Object) return Wide_Wide_String with
225 Inline;

Last Argument Option Found.

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

Return value

Get_ExtractGNU [source]

272 function Get_ExtractGNU (This : in Object) return Boolean with
273 Inline;

Get GNU Option extraction flag. GNU-Options start with "--" and have the Format --option=argument.

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

Return value

True if GNU options are parsed.

Get_GNUOption [source]

240 function Get_GNUOption (This : in Object) return Wide_Wide_String with
241 Inline;

Last GNU-Option Found.

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

Return value

GNU option found.

Get_Optind [source]

217 function Get_Optind (This : in Object) return Positive with
218 Inline;

Nr of Last Option processed

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

Return value

Get_Option [source]

232 function Get_Option (This : in Object) return Wide_Wide_Character with
233 Inline;

Last Single Character Option Found.

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

Return value

Option found.

Get_Pattern [source]

248 function Get_Pattern (This : in Object) return Wide_Wide_String with
249 Inline;

Get Format string. The usual mix of options and ':'

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

Return value

currently used pattern.

Next [source]

123 procedure Next (This : in out Object; Found : out FoundFlag);

get next Option.

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

Found of type AdaCL.Command_Line.GetOpt.FoundFlag

Result of the Next command

Parse [source]

129 procedure Parse (This : in out Object);

Start Parsing the command line.

This of type AdaCL.Command_Line.GetOpt.Object

the Object itself

Set_ExceptionOnError [source]

264 procedure Set_ExceptionOnError (This : in out Object; ExceptionOnError : in Boolean := True) with
265 Inline;

Set error handling on or off

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

ExceptionOnError of type Boolean

when true raise exception on error else return option ':' or '?'

Set_ExtractGNU [source]

280 procedure Set_ExtractGNU (This : in out Object; ExtractGNU : in Boolean := True) with
281 Inline;

Set GNU Option extraction flag. GNU-Options start with "--" and have the Format --option=argument.

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

ExtractGNU of type Boolean

When true, gnu options are extracted.

Set_Pattern [source]

256 procedure Set_Pattern (This : in out Object; Pattern : in Wide_Wide_String) with
257 Inline;

Set Format string. The usual mix of options and ':'

This of type AdaCL.Command_Line.GetOpt.Object

Object itself.

Pattern of type Wide_Wide_String

Pattern to parse.

WriteHelp [source]

211 procedure WriteHelp (This : in out Object);

A Call for Help was found on the command line

This of type AdaCL.Command_Line.GetOpt.Object

the Object itself