demo9 – M_CLI2
Author: John S. Urban
Description: command line parsing

# demo9 Program

- 13 statements
- Source File

### Uses

- - M_CLI2

@(#) long and short names using –LONGNAME:SHORTNAME

When all keys have a long and short name and “strict mode” is invoked where “-” is required for short names and “–” for long names Boolean values may be bundled together. For example:

demo9 -XYZ

### Contents

### Variables

all

### Source Code

demo9

## Variables

Type | Attributes |  | Name |  | Initial |
--- | --- | --- | --- | --- | --- | ---
character(len=*), | parameter | :: | all | = | '(*(g0))' |

## Source Code

    program demo9
    !> @(#) long and short names using --LONGNAME:SHORTNAME
    !!
    !!  When all keys have a long and short name and "strict mode" is invoked
    !!  where "-" is required for short names and "--" for long names Boolean
    !!  values may be bundled together. For example:
    !!
    !!    demo9 -XYZ
    !!
    use M_CLI2,  only : set_args, sget, rget, lget, set_mode
    implicit none
    character(len=*),parameter :: all='(*(g0))'

       print *,'demo9: long and short names using --LONGNAME:SHORTNAME'
       !call set_mode('strict')
       call set_args('    &
       & --length:l 10    &
       & --height:h 12.45 &
       & --switchX:X F    &
       & --switchY:Y F    &
       & --switchZ:Z F    &
       & --title:T "my title"')
       print all,'--length or -l .... ',rget('length')
       print all,'--height or -h .... ',rget('height')
       print all,'--switchX or -X ... ',lget('switchX')
       print all,'--switchY or -Y ... ',lget('switchY')
       print all,'--switchZ or -Z ... ',lget('switchZ')
       print all,'--title or -T ..... ',sget('title')
    end program demo9