ControlTier Inc. > CTL
 
Font size:      

Get-Opts

Description

GetOpts task parses the module's commandline options in the tradition of getopt(s)

Parameters

AttributeDescriptionRequired
optsValueThe commandline options input (NOTE: optsProperty is deprecated)Yes
failonerrorboolean flag for module to fail when get-opts error occurs.Yes
errorPropertyproperty containing error (if any)Yes
usagePropertyproperty to representing module usage (dynamically generated)Yes
stopAtNonOptionOptional, if set to true, will modify the behavior of get-opts to stop at the 1st unrecognized property and set property identified by remainingArgsProperty to contain the rest of the command line. Must be used with remainingArgsProperty attribute.No
remainingArgsPropertyOptional, when stopAtNonOption is set to true, property name to contain the rest of command line when unrecognized option is encountered.No

Parameters specified as nested elements

opts

Exactly one opts element.

NOTE: commander framework property ${cmd.line} will contain the options after the -- commandline separator and can be used as the input value to the get-opts optsValue attribute.

Examples

process module command line arguments

        <get-opts optsValue="-object myObject -restart"
                     failonerror="true"
                     errorProperty="mymodule.error"
                     usageProperty="mymodule.usage">
           <opts>
              <opt parameter="object"
                      type="string"
                      property="object.value"
                      required="true"
                      description="object name"/>

              <opt parameter="type"
                      type="string"
                      property="type.value"
                      required="false"
                      default="MyType"
                      description="optional type"/>

              <opt parameter="restart"
                      type="boolean"
                      property="restart.value"
                      required="true"
                      description="restart flag"/>

           </opts>
        </get-opts>