# MArgParser

## Base Class

None.

## Constants

None.

## Static Methods

None.

## Constructors

Signature | Parameters | Description
--- | --- | ---
MArgParser(syntax, args) | syntax - MSyntax args - MArgList | Creates a new MArgParser object which will parse args using the provided syntax.

## Virtual Methods

None.

## Object Methods

Signature | Parameters | Returns | Description
--- | --- | --- | ---
commandArgumentBool(index) | index - int | bool | Returns the specified command argument as a bool.
commandArgumentDouble(index) | index - int | float | This is an alternate name for commandArgumentFloat()
commandArgumentFloat(index) | index - int | float | Returns the specified command argument as a float.
commandArgumentInt(index) | index - int | int | Returns the specified command argument as an int.
commandArgumentMAngle(index) | index - int | MAngle | Returns the specified command argument as an MAngle.
commandArgumentMDistance(index) | index - int | MDistance | Returns the specified command argument as an MDistance.
commandArgumentMTime(index) | index - int | MTime | Returns the specified command argument as an MTime.
commandArgumentString(index) | index - int | string | Returns the specified command argument as a string.
flagArgumentBool(flag, index) | flag - string index - int | bool | Returns the index'th argument of the specified flag as a bool. Raises RuntimeError if the flag has been enabled for multi-use.
flagArgumentDouble(flag, index) | flag - string index - int | float | This is an alternate name for flagArgumentFloat().
flagArgumentFloat(flag, index) | flag - string index - int | float | Returns the index'th argument of the specified flag as a float. Raises RuntimeError if the flag has been enabled for multi-use.
flagArgumentInt(flag, index) | flag - string index - int | int | Returns the index'th argument of the specified flag as a int. Raises RuntimeError if the flag has been enabled for multi-use.
flagArgumentMAngle(flag, index) | flag - string index - int | MAngle | Returns the index'th argument of the specified flag as an MAngle. Raises RuntimeError if the flag has been enabled for multi-use.
flagArgumentMDistance(flag, index) | flag - string index - int | MDistance | Returns the index'th argument of the specified flag as an MDistance. Raises RuntimeError if the flag has been enabled for multi-use.
flagArgumentMTime(flag, index) | flag - string index - int | MTime | Returns the index'th argument of the specified flag as an MTime. Raises RuntimeError if the flag has been enabled for multi-use.
flagArgumentString(flag, index) | flag - string index - int | string | Returns the index'th argument of the specified flag as a string. Raises RuntimeError if the flag has been enabled for multi-use.
getFlagArgumentList(flag, occurrence) | flag - string occurrence - int | MArgList | Returns the arguments for the specified occurrence of the given multi-use flag as an MArgList. Raises RuntimeError if the flag has not been enabled for multi-use. Raises IndexError if occurrence is out of range.
getFlagArgumentPosition(flag, occurrence) | flag - string index - int | int | Returns the position in the argument list of the specified occurrence of the given flag. Raises IndexError if occurrence is out of range.
getObjectStrings() |  | tuple of strings | If the command's MSyntax has set the object format to kStringObjects then this method will return the objects passed to the command as a tuple of strings. If any other object format is set then an empty tuple will be returned.
isFlagSet(flag) | flag - string | bool | Returns True if the given flag appears on the command line.
numberOfFlagUses(flag) | flag - string | int | Returns the number of times that the flag appears on the command line.

## Object Attributes

Name | Type | Access | Description
--- | --- | --- | ---
isEdit | bool | R | True if the -edit flag is present.
isQuery | bool | R | True if the -query flag is present.
numberOfFlagsUsed | int | R | Number of different flags used on the command line. If the same flag appears multiple times it is only counted once.

## Sequence Support

None.

## Number Support

None.

## Comparison Support

None.

## str() Support

Default.

## repr() Support

Default.

© 2011 Autodesk, Inc. All rights reserved.