julienne_command_line_m.f90 Source File


Files dependent on this one

sourcefile~~julienne_command_line_m.f90~~AfferentGraph sourcefile~julienne_command_line_m.f90 julienne_command_line_m.f90 sourcefile~julienne_command_line_s.f90 julienne_command_line_s.f90 sourcefile~julienne_command_line_s.f90->sourcefile~julienne_command_line_m.f90 sourcefile~julienne_m.f90 julienne_m.f90 sourcefile~julienne_m.f90->sourcefile~julienne_command_line_m.f90 sourcefile~julienne_test_m.f90 julienne_test_m.F90 sourcefile~julienne_m.f90->sourcefile~julienne_test_m.f90 sourcefile~julienne_test_m.f90->sourcefile~julienne_command_line_m.f90 sourcefile~assertions.f90 assertions.F90 sourcefile~assertions.f90->sourcefile~julienne_m.f90 sourcefile~check-for-command-line-argument.f90 check-for-command-line-argument.f90 sourcefile~check-for-command-line-argument.f90->sourcefile~julienne_m.f90 sourcefile~get-command-line-flag-value.f90 get-command-line-flag-value.f90 sourcefile~get-command-line-flag-value.f90->sourcefile~julienne_m.f90 sourcefile~julienne_test_s.f90 julienne_test_s.F90 sourcefile~julienne_test_s.f90->sourcefile~julienne_test_m.f90

Source Code

! Copyright (c) 2024-2025, The Regents of the University of California and Sourcery Institute
! Terms of use are as specified in LICENSE.txt
module julienne_command_line_m
  !! return command line argument information
  implicit none

  private
  public :: command_line_t

  type command_line_t
  contains
    procedure, nopass :: argument_present
    procedure, nopass :: flag_value
  end type

  interface

    module function argument_present(acceptable_argument) result(found)
      implicit none
      !! result is .true. only if a command-line argument matches an element of this function's argument
      character(len=*), intent(in) :: acceptable_argument(:)
        !! sample list: [character(len=len(<longest_argument>)):: "--benchmark", "-b", "/benchmark", "/b"]
        !! where dashes support Linux/macOS, slashes support Windows, and <longest_argument> must be replaced
        !! by the longest list element ("--benchmark" above)
      logical found
    end function

    module function flag_value(flag)
      !! result = { the value passed immediately after a command-line flag if the flag is present or
      !!          { an empty string otherwise.
      implicit none
      character(len=*), intent(in) :: flag
      character(len=:), allocatable :: flag_value
    end function

  end interface

end module