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

# parse Subroutine

- 7 statements
- Source File

## subroutine parse()

### Uses

- - M_CLI2

Put everything to do with command parsing here

DEFINE COMMAND OPTIONS AND DEFAULT VALUES

## VERSION TEXT (with optional @(#) prefix for what(1) command)

### Arguments

None

### Contents

### Source Code

parse

## Source Code

    subroutine parse()
    !! Put everything to do with command parsing here
    !!
    use M_CLI2,  only : set_args, set_mode
    call set_mode([character(len=20) :: 'strict','ignorecase'])
    ! a single call to set_args can define the options and their defaults, set help
    ! text and version information, and crack command line.
    call set_args(&
    !! DEFINE COMMAND OPTIONS AND DEFAULT VALUES
    ' &
     -i 1 -j 2 -k 3     &
     -l F -m F -n F     &
     -x 1 -y 2 -z 3     &
     --title "my title" &
    !! ## HELP TEXT ##
    ', [character(len=80) :: &
    !12345678901234567890123456789012345678901234567890123456789012345678901234567890
    'NAME                                                                            ', &
    '   myprogram(1) - make all things possible                                      ', &
    'SYNOPSIS                                                                        ', &
    '   myprogram [-i NNN] [-j NNN] [-k NNN] [-l] [-m] [-n] ]                        ', &
    '             [-x NNN.mm] [-y NNN.mm] [-z NNN.mm] [FILENAMES]                    ', &
    'DESCRIPTION                                                                     ', &
    '   myprogram(1) makes all things possible given stuff.                          ', &
    'OPTIONS                                                                         ', &
    '   -i,-j,-k   some integer values                                               ', &
    '   -l,-m,-n   some logical values                                               ', &
    '   -x,-y,-z   some real values                                                  ', &
    '   --title    a string argument                                                 ', &
    '   FILENAMES  any additional strings                                            ', &
    'EXAMPLE                                                                         ', &
    '   Typical usage:                                                               ', &
    '                                                                                ', &
    '     demo17 *.*                                                                 ', &
    '                                                                                ', &
    '                                                                                ', &
    !! ## VERSION TEXT (with optional @(#) prefix for what(1) command) ##
    '' ], [character(len=80) :: &
    '@(#)PROGRAM:     demo17           >', &
    '@(#)DESCRIPTION: My demo program  >', &
    '@(#)VERSION:     1.0 20200115     >', &
    '@(#)AUTHOR:      me, myself, and I>', &
    '@(#)LICENSE:     Public Domain    >', &
    '' ])

    end subroutine parse