aboutsummaryrefslogtreecommitdiff
path: root/test.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-04-24 21:47:09 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-04-24 21:47:09 -0400
commiteb8d9bc74a0624dbc98ffb75268a3ba57bd43b40 (patch)
tree04e77c082b1c87778f06fe53798db6bb284f834c /test.f90
downloadLR-87-eb8d9bc74a0624dbc98ffb75268a3ba57bd43b40.tar.gz
LR-87-eb8d9bc74a0624dbc98ffb75268a3ba57bd43b40.zip
Initial code commit
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