aboutsummaryrefslogtreecommitdiff
path: root/test.f90
diff options
context:
space:
mode:
Diffstat (limited to 'test.f90')
-rw-r--r--test.f9060
1 files changed, 60 insertions, 0 deletions
diff --git a/test.f90 b/test.f90
new file mode 100644
index 0000000..df42126
--- /dev/null
+++ b/test.f90
@@ -0,0 +1,60 @@
+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] <file to load>"
+ Print *, " "
+ Print *, " -g Treat file as text/gemini"
+ Print *, " "
+
+ end subroutine usage
+
+end program test_render \ No newline at end of file