program test_render use file_handling use layout use dumb_render implicit none character(256)::path, arg integer::i type(line), pointer::first_line integer::iostatus character(32)::mime type(dumb_renderer)::r if(command_argument_count() < 1) then call usage() stop 0 end if mime = "text/plain" do i = 1, command_argument_count() call get_command_argument(i, arg) if(trim(arg) == "-g") then mime = "text/gemini" else if(arg(1:1) == "-") then Print *, "Unknown option: "//trim(arg) Print *, " " call usage() stop 0 else path = arg end if end do first_line => load_filename(trim(path), iostatus, mime) if(iostatus == 0) then call r%initialize() call layout_lines(first_line, r) else Print *, "Error occurred while loading "//trim(path) end if contains subroutine usage() implicit none character(256)::exe call get_command_argument(0, exe) Print *, "Usage: "//trim(exe)//" [-g] " Print *, " " Print *, " -g Treat file as text/gemini" Print *, " " end subroutine usage end program test_render