Initial code for convert positions reads a file name from the command

line and attempts to connect to it as a SQLite3 database.
master
Pablo Virgo 2016-05-04 22:54:59 -04:00
parent 2148f868a6
commit 20de7900ac
1 changed files with 25 additions and 0 deletions

25
convert-positions.rkt Normal file
View File

@ -0,0 +1,25 @@
#! /usr/bin/env racket
#lang racket
(require db racket/cmdline "world/blocks.rkt")
;; #### Functions
;; String -> Database connection
;; Take the file-name of a Minetest world as a string, return a SQL
;; database connection
(define (open-minetest-world world)
(let ([minetest-world (sqlite3-connect #:database world)])
(if (connected? minetest-world)
minetest-world
(raise (string-append "Could not open " world)))))
;; Command line -> Database Connection
;; Parse command line options, use a helper funtion to return a database
;; connection or error-out as appropriate.
(define minetest-world-db
(command-line
#:program "Convert Positions"
#:args (world)
(open-minetest-world world)))