Testing CommandLineInterface: example-1
Class and modules
- [[CommandLineInterface_]]
Usage
!!! note "" Import modules
PROGRAM main
USE easifemBase
USE easifemClasses
IMPLICIT NONE
Declare variables
TYPE(CommandLineInterface_) :: obj
CHARACTER(99) :: chars
INTEGER :: error
#CommandLineInterface/Initiate initiate an instance
CALL obj%Initiate(description='minimal example')
#CommandLineInterface/Add add an option
CALL obj%add(switch='--string', switch_ab='-s', help='a string', required=.TRUE., &
& act='store', error=error)
check error
IF (error /= 0) STOP
#CommandLineInterface/Get get the value of an option
CALL obj%get(switch='-s', val=chars, error=error)
check error
IF (error /= 0) STOP
print results and clean up
PRINT '(A)', obj%progname//' has been called with the following argument:'
PRINT '(A)', 'chars = '//TRIM(ADJUSTL(chars))
CALL obj%Deallocate()
END PROGRAM main