-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli_mo_template.f90
executable file
·95 lines (63 loc) · 2.35 KB
/
cli_mo_template.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
!==================================================================
! Command Line Interface (Template)
!
! Created by: Hisashi Takeda, Ph.D. 2019-01-19
!==================================================================
module cli_mo
include '/home/jma/1_Projects/include/cli_header.f90'
contains
subroutine get_args (this, config, date_fr, date_to, mode)
class(cmd_ty), intent(in) :: this
character(*), intent(inout), optional :: config, date_fr, date_to, mode
date_time = get_date_time ()
if (command_argument_count() == 0) call this%print_help
print '(a)', ''
print '(a)', '======================================================'
print '(a)', trim(cmd%title)
print '(a)', '======================================================'
print '(a)', 'Command arguments'
print '(a)', ''
do while (i_arg <= command_argument_count())
call get_command_argument (i_arg, arg, status = status)
select case (adjustl(arg))
case ('--config')
call get_value (config, i_arg)
case ('--date_fr')
call get_value (date_fr, i_arg)
case ('--date_to')
call get_value (date_to, i_arg)
case ('--mode')
call get_value (mode, i_arg)
case ('-v', '--version')
call this%print_version (date_time)
case ('-h', '--help')
call this%print_help
case ('--time')
print *, 'Current time: ', date_time
case ('--idummy')
idummy = 1
call get_value (idummy, i_arg)
case ('--rdummy')
rdummy = 1.0d0
call get_value (rdummy, i_arg)
case ('--ldummy')
ldummy = .false.
call get_value (ldummy, i_arg)
case default
print '(a, a, /)', 'Unrecognized command-line option: ', arg
call this%print_help
end select
if (status /= 0) print *, 'Error', status, 'on argument', i_arg
i_arg = i_arg + 1
end do
print '(a)', '======================================================'
call getcwd(cwd)
#ifdef debug
print *, 'Program name: '//trim(this%exe)
print *, 'Number of command arguments: ', command_argument_count()
print *, 'Current working directory: '//trim(cwd)
print *, ''
#endif
end subroutine get_args
include '/home/jma/1_Projects/include/cli_footer.f90'
end module