pic_command_line.f90 Source File

The pic_command_line.f90 file will contain all routines that will interact with the command line


This file depends on

sourcefile~~pic_command_line.f90~~EfferentGraph sourcefile~pic_command_line.f90 pic_command_line.f90 sourcefile~pic_types.f90 pic_types.F90 sourcefile~pic_command_line.f90->sourcefile~pic_types.f90

Source Code

!! The pic_command_line.f90 file will contain all routines that will interact with the command line

module pic_command_line
  !! command line interaction module
   use pic_types, only: default_int
   implicit none

   private
   public :: get_first_arg_from_command_line
contains

   function get_first_arg_from_command_line() result(filename)
      !! get the first argument from the command line, this is expected to be a filename
      !!
      !! Usage: filename = get_first_arg_from_command_line()
      !!
      character(len=255) :: filename
      character(len=255) :: arg
      integer(default_int) :: num_args

      num_args = command_argument_count()

      if (num_args < 1) then
         write (*, "(A)") "Usage: ./my_executable <filename>"
         stop 1
      end if

      call get_command_argument(1, arg)

      filename = trim(adjustl(arg))

   end function get_first_arg_from_command_line

end module pic_command_line