Skip to content

Instantly share code, notes, and snippets.

@funrep
Created March 2, 2013 17:48
Show Gist options
  • Save funrep/5072184 to your computer and use it in GitHub Desktop.
Save funrep/5072184 to your computer and use it in GitHub Desktop.
;; Main source file, command-line argument parsing
;; See LICENSE for licensing information
(use args ports)
(include "init.scm")
(include "post.scm")
(include "build.scm")
(define prog "stipes")
(define version "0.1")
(define author "kalle97r at gmail.com")
(define opts
(list (args:make-option (i init) #:optional "Initializes a site in current directory"
(print "initializing..."))
(args:make-option (p post) #:optional "Posts a blog post"
(print "posting..."))
(args:make-option (b build) #:optional "Builds site in out"
(print "building.."))
(args:make-option (v version) #:optional "Display version"
(print prog " v. " version)
(exit))
(args:make-option (h help) #:optional "Display this message"
(usage))))
(define (usage)
(with-output-to-port (current-error-port)
(lambda ()
(print "Usage: " prog " [options...] [files...]")
(newline)
(print (args:usage opts))
(print "Report bugs to " author)))
(exit 1))
(if (null? (command-line-arguments))
(usage)
(args:parse (command-line-arguments) opts))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment