show_available.f90 Source File


This file depends on

sourcefile~~show_available.f90~~EfferentGraph sourcefile~show_available.f90 show_available.f90 sourcefile~constants.f90 constants.f90 sourcefile~show_available.f90->sourcefile~constants.f90

Files dependent on this one

sourcefile~~show_available.f90~~AfferentGraph sourcefile~show_available.f90 show_available.f90 sourcefile~forsus.f90 forsus.F90 sourcefile~forsus.f90->sourcefile~show_available.f90

Source Code

module forsus__available
    !! Show what substances are available in the database
contains
    subroutine show_available(sus)
        !! Show the available substances in the database
        use forsus_constants, only: forsus_dir, forsus_default_dir
        character(len=*), optional, intent(in out) :: sus
        integer :: funit

        character(len=*), parameter :: pst_command="| fzf | cut -d'.' -f1 > /tmp/forsus"


        if (allocated(forsus_dir)) then
            call system("ls " // forsus_dir // pst_command)
        else
            call system("ls " // forsus_default_dir // pst_command)
        end if

        if (present(sus)) then
            open(newunit=funit, file="/tmp/forsus")
            read(funit, "(A)") sus
            close(funit)
        end if
    end subroutine
end module